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:
A few questions. . . (1997)
Major bug report on rootbeer (1997)
Help! WebCat2 bug (1997)
New Command prefs ... (1997)
username = 115 (1999)
template includes encrypted template (1999)
Webcat2, WebCommerce, Mod 10 etc. (1997)
Shopping problems with 2.1b3 acgi (1997)
WebCatalog Hosting (1996)
The code, one more time. (2003)
carriage returns in data (1997)
form data submission gets truncated (1997)
[OT] Communigate List (2003)
WebCat2 beta 11 - new prefs ... (1997)
New WebDNA Forum Solution (in development) (2003)
Bit off subject -- Faxing orders (1997)
OT: [WAY IN RIGHT FIELD SOMEWHERE] Spam Filters (2005)
More Applescript (1997)
WML (2000)
Enhancement Request for WebCatalog-NT (1996)