Re: oddball sorting problem

This WebDNA talk-list message is from

2003


It keeps the original formatting.
numero = 55051
interpreted = N
texte = To restate the problem as I think I understand it... a) You want to show all sales that have either their first or second date on or after today. This works as written. b) You want to sort by the earliest of the two dates, ignoring any date that is prior to today. This doesn't work - if the first date is prior to today, then it will sort to the top of the list. I can't think of any way to so the sorting you want within a search of the original db - there is no way to say "sort by first date then second date, but ignore the first date if it's prior to today". To get the sort you want based on your current db structure, you need to search to find the records then append the records to a table (if WebDNA 5) or a temporary DB, using one "sort date" field that holds the date (chosen by if/then/else from date1 or date2) that the sale should be sorted by. Then you need to search the table sorting on the sort date to generate the desired results. Alternatively, you could add a "sort date" field to the original DB and run a nightly trigger that puts the chosen value into that field and clears that field if the sale was in the past. This would simplify the search and sort to: [search ....gesortDatedatarq=[date]&allhit=1&sortDatesort=1&sortDatetype=date] - brian On Dec 17, 2003, at 8:56 PM, Terry Wilson wrote: > Doing a little more digging, I found allhit=1 in the online docs to > turn off relevancy, and that cleared it up, mostly. > > However, when the second date is still in the future, it is sorting on > the 1st (past) date. I'd rather have the 2nd date be the one in the > sort order. I don't see a straightforward solution to this without > using a trigger to update the database daily, or something, so I guess > I'll just live with it. > > Terry > > At 11:22 PM -0500 12/17/03, Terry Wilson wrote: > I have this: > > [search > ...group1field=date1+date2&group1type=date&gegroup1datarq=[date]&date1t > ype=date&date1sort=1] > > I originally had this: > > [search ...date1type=date&gedate1datarq=[date]&date1sort=1] > > The original search returned the records in the ascending order that I > expected. When I altered it to include a second date (some events > might have two dates), now it sorts screwy. Events with two dates > float to the top (sorted correctly if both dates meet the ge > criterion), followed by double dates where one date meets the > requirement, and finally, the single date items (again, sorted > correctly). What is causing the two-date items to precede the others? > > Maybe a clarification of what exactly is happening with grouped fields > will help. > > I have it roughed out at http://terryfic.com/~yardsales/ > > Feel free to play with it. It will be up for a few more days as I > develop it. > > Thanks, > Terry > -- Brian Fries, BrainScan Software -- http://www.brainscansoftware.com -- ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
  1. Re: oddball sorting problem ( Terry Wilson 2003)
  2. Re: oddball sorting problem [feature request] ( Donovan Brooke 2003)
  3. Re: oddball sorting problem ( Brian Fries 2003)
  4. Re: oddball sorting problem ( Terry Wilson 2003)
  5. Re: oddball sorting problem ( Donovan Brooke 2003)
  6. oddball sorting problem -- almost okay now ( Terry Wilson 2003)
  7. Re: oddball sorting problem ( Tim Robinson 2003)
  8. Re: oddball sorting problem ( "WebDna @" 2003)
  9. oddball sorting problem ( Terry Wilson 2003)
To restate the problem as I think I understand it... a) You want to show all sales that have either their first or second date on or after today. This works as written. b) You want to sort by the earliest of the two dates, ignoring any date that is prior to today. This doesn't work - if the first date is prior to today, then it will sort to the top of the list. I can't think of any way to so the sorting you want within a search of the original db - there is no way to say "sort by first date then second date, but ignore the first date if it's prior to today". To get the sort you want based on your current db structure, you need to search to find the records then append the records to a table (if WebDNA 5) or a temporary DB, using one "sort date" field that holds the date (chosen by if/then/else from date1 or date2) that the sale should be sorted by. Then you need to search the table sorting on the sort date to generate the desired results. Alternatively, you could add a "sort date" field to the original DB and run a nightly trigger that puts the chosen value into that field and clears that field if the sale was in the past. This would simplify the search and sort to: [search ....gesortDatedatarq=[date]&allhit=1&sortDatesort=1&sortDatetype=date] - brian On Dec 17, 2003, at 8:56 PM, Terry Wilson wrote: > Doing a little more digging, I found allhit=1 in the online docs to > turn off relevancy, and that cleared it up, mostly. > > However, when the second date is still in the future, it is sorting on > the 1st (past) date. I'd rather have the 2nd date be the one in the > sort order. I don't see a straightforward solution to this without > using a trigger to update the database daily, or something, so I guess > I'll just live with it. > > Terry > > At 11:22 PM -0500 12/17/03, Terry Wilson wrote: > I have this: > > [search > ...group1field=date1+date2&group1type=date&gegroup1datarq=[date]&date1t > ype=date&date1sort=1] > > I originally had this: > > [search ...date1type=date&gedate1datarq=[date]&date1sort=1] > > The original search returned the records in the ascending order that I > expected. When I altered it to include a second date (some events > might have two dates), now it sorts screwy. Events with two dates > float to the top (sorted correctly if both dates meet the ge > criterion), followed by double dates where one date meets the > requirement, and finally, the single date items (again, sorted > correctly). What is causing the two-date items to precede the others? > > Maybe a clarification of what exactly is happening with grouped fields > will help. > > I have it roughed out at http://terryfic.com/~yardsales/ > > Feel free to play with it. It will be up for a few more days as I > develop it. > > Thanks, > Terry > -- Brian Fries, BrainScan Software -- http://www.brainscansoftware.com -- ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Brian Fries

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:

Netscape v. IE (1997) Help!!!! (1997) all records returned. (1997) More questions about serial number dishing (1997) Date Bug (1998) Re:Signal Raised (1997) [WebDNA] WebDNA and simple password systems (2009) formatting dates from a field ... (1997) Secure Server (1997) Problem (1997) Multiple Items (2004) [WebDNA] Problems with the Emailer Queue (2012) Summing fields (1997) [WebDNA] SpeedTest (2009) Package Prices (2000) encrypt method=APOP broken or just not enough docs? - was MD5encryption (2003) Multiple catalog databases and showcart (1997) Help name our technology! (1997) WebTen and WebCat (1997) Credit card processing - UK (1997)