Re: [WebDNA] Dynamic vertical columns
This WebDNA talk-list message is from 2008
It keeps the original formatting.
numero = 100630
interpreted = N
texte = If you know the number of columns you want, divide [founditems] by that number, then nest that number of searches into a single-row table. Each cell contains a nested, single-column table with the respective range of the results.You can even calculate the width if you want to, by finding the widest result.This eliminates recursive lookups and even excessing table sorting.On Sep 2, 2008, at 7:27 AM, Stuart Tremain wrote:>> And here it is for 4 columns - as Toby suggested earlier you can use > CSS to make it "look" like tables if required.>>>> [Search db=^data/species.db&neSACTIVEdatarq=ALL&asSCOMMONNAMEsort=1]> NumFound = [NumFound]
> remainder=[Math]remainder=[NumFound]%4[/Math]
> percolumn=[Math]percolumns=floor([NumFound]/4)[/Math]
> totalpercolumn=[Math]totalpercolumn=[Switch value=[remainder]][Case > value=0]0[/Case][Default]1[/Default][/Switch]+[percolumns][/Math]
>>
> > COL 01 | > COL 02 | > COL 03 | > COL 04 | >
>> > [FoundItems][ShowIf [Index]<[math][totalpercolumn] > +1[/math]][index] - [scommonname] [/ShowIf][/FoundItems] | >> [FoundItems][If ([Index]>[Math][totalPERCOLUMN][/ > Math])&([Index]<[math][NumFound]-[totalPERCOLUMN]-[totalPERCOLUMN]+ > [Switch value=[remainder]][Case value=3]2[/Case][Case value=2]3[/ > Case][Case value=1]4[/Case][Case value=0]1[/Case][Default]0[/Default] > [/Switch][/math])][then][index] - [scommonname] [/Then][/If][/ > FoundItems] | >> [FoundItems][If ([Index]>[Math][totalPERCOLUMN]+ > [totalPERCOLUMN][/Math])&([Index]<[math][NumFound]-[totalPERCOLUMN]+ > [Switch value=[remainder]][Case value=3]2[/Case][Case value=2]3[/ > Case][Case value=1]4[/Case][Case value=0]1[/Case][Default]0[/Default] > [/Switch][/math])][then][index] - [scommonname] [/Then][/If][/ > FoundItems] | >> [FoundItems][ShowIf [Index]>[Math][NumFound]- > [totalpercolumn]+[Switch value=[remainder]][Case value=3]1[/Case] > [Case value=2]2[/Case][Case value=1]3[/Case][Default]0[/Default][/ > Switch][/Math]][index] - [scommonname] [/ShowIf][/FoundItems] | >>
>
>> [/Search]>>>>> ---------------------------------------------------------> This message is sent to you because you are subscribed to> the mailing list
.> To unsubscribe, E-mail to: >
Associated Messages, from the most recent to the oldest:
If you know the number of columns you want, divide [founditems] by that number, then nest that number of searches into a single-row table. Each cell contains a nested, single-column table with the respective range of the results.You can even calculate the width if you want to, by finding the widest result.This eliminates recursive lookups and even excessing table sorting.On Sep 2, 2008, at 7:27 AM, Stuart Tremain wrote:>> And here it is for 4 columns - as Toby suggested earlier you can use > CSS to make it "look" like tables if required.>>>> [Search db=^data/species.db&neSACTIVEdatarq=ALL&asSCOMMONNAMEsort=1]> NumFound = [NumFound]
> remainder=[math]remainder=[NumFound]%4[/Math]
> percolumn=[math]percolumns=floor([NumFound]/4)[/Math]
> totalpercolumn=[math]totalpercolumn=[Switch value=[remainder]][Case > value=0]0[/Case][Default]1[/Default][/Switch]+[percolumns][/Math]
>> > > COL 01 | > COL 02 | > COL 03 | > COL 04 | >
>> > [founditems][ShowIf [Index]<[math][totalpercolumn] > +1[/math]][index] - [scommonname] [/ShowIf][/FoundItems] | >> [founditems][If ([Index]>[math][totalPERCOLUMN][/ > Math])&([Index]<[math][NumFound]-[totalPERCOLUMN]-[totalPERCOLUMN]+ > [Switch value=[remainder]][Case value=3]2[/Case][Case value=2]3[/ > Case][Case value=1]4[/Case][Case value=0]1[/Case][Default]0[/Default] > [/Switch][/math])][then][index] - [scommonname] [/Then][/If][/ > FoundItems] | >> [founditems][If ([Index]>[math][totalPERCOLUMN]+ > [totalPERCOLUMN][/Math])&([Index]<[math][NumFound]-[totalPERCOLUMN]+ > [Switch value=[remainder]][Case value=3]2[/Case][Case value=2]3[/ > Case][Case value=1]4[/Case][Case value=0]1[/Case][Default]0[/Default] > [/Switch][/math])][then][index] - [scommonname] [/Then][/If][/ > FoundItems] | >> [founditems][ShowIf [Index]>[math][NumFound]- > [totalpercolumn]+[Switch value=[remainder]][Case value=3]1[/Case] > [Case value=2]2[/Case][Case value=1]3[/Case][Default]0[/Default][/ > Switch][/Math]][index] - [scommonname] [/ShowIf][/FoundItems] | >>
>
>> [/Search]>>>>> ---------------------------------------------------------> This message is sent to you because you are subscribed to> the mailing list .> To unsubscribe, E-mail to: >
Patrick McCormick
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
Where's Cart Created ? (1997)
PSC recommends what date format yr 2000??? (1997)
Locking up with WebCatalog... (1997)
RE: E-mailer error codes (1997)
Large sites (2003)
Image as submit button (2000)
[WebDNA] Silly question (2009)
RE: WebDNA-Talk searchable? (1997)
Help name our technology! (1997)
[OT] Google Info (2004)
pc (1997)
WC1.6 to WC2 date formatting (1997)
Dumb Question about Docs (1997)
WebCat2b12 CGI Mac - [shownext] problem (1997)
WebCatalog Upgrade Pricing? (1997)
template cache problem (1998)
WebCat editing, SiteGuard WAS:SiteAssociative lookup style? (1997)
Signal Raised error (1997)
4.x in production update (2000)
webcat- multiple selection in input field (1997)