Re: Date Help - Searching the same field twice
This WebDNA talk-list message is from 2004
It keeps the original formatting.
numero = 56428
interpreted = N
texte = There is a way to search the same field twice, using the GROUP field featureto create an alias. For example:[search db=admin/-Timesheets.db&eqTSUserNamedatarq=[USERNAME]&GROUP1field=TSDATE&GROUP1type=date&geTSDATEdatarq=[SDate]&lsGROUP1datarq=[EDate]&asTSDATEsort=1&TSDATEtype=date]-----Original Message-----From: WebDNA Talk [mailto:WebDNA-Talk@talk.smithmicro.com]On Behalf OfBrian FriesSent: Friday, February 27, 2004 8:54 AMTo: WebDNA TalkSubject: Re: Date HelpSome of this has been said by others, but I'll clarify four points onyour issue:1) I assume you have your WebDNA preferences set properly for UK dateformats. If not, it won't work properly.2) [math date] will return the value as a date in the format specifiedin preferences, BUT, the math variable being set inside the mathcontext is actually holding the "days since 31Dec0000" value. You cansee this by displaying your SDate or EDate variables outside of themath context. Math variables can only hold numbers, and 01/02/2004 isnot a number. To set a variable with the formatted date, you could use:[text]SDate=[math date]{01/[date %m]/[date %Y]}[/math][/text]3) You cannot directly search the same database field twice in a searchcontext - doing both a "geTSDatedatarq" and a "lsTSDatedatarq" in thesame search, one of them will be ignored. In this case, a range searchwould be your answer:....rnTSDatedatarq=[SDate]+[EDate]...4) If you want a strict by-date sort, you should add "&allhit=1" toyour search string. This will disable WebDNA's best-match sorting.Otherwise your date sort will be secondary to WebDNA's best-match sort- records WebDNA considers to be equally ranked will be sorted by date.It may not make a difference in your case, as WebDNA may consider allfound records to be equally ranked, but it is good practice wheneveryou want a specific sort sequence.- brianOn Feb 27, 2004, at 6:55 AM, Steve Craig wrote:> Hi>> OK, I am officially going off my head. I have re-used a piece of> otherwise> working code and it's not working and I cannot see why. Basically I> want to> return the timesheet records a given user for the current month. The> records> have a field called TSDATE which is in dd/mm/yyyy (UK Format). I know I> could save these as numbers but would prefer to work in this format.>> (I have put a return in after each & in the search string to save any> funny> returns from the email.)>> [math date]SDate={01/[date %m]/[date %Y]}[/math] -> 01/02/2004> [math date]EDate={01/[date %m]/[date %Y]}+{00/01/0000}[/math] -> 01/03/2004>> [search db=admin/-Timesheets.db&> eqTSUserNamedatarq=[USERNAME]&> geTSDATEdatarq=[SDate]&> lsTSDATEdatarq=[EDate]&> asTSDATEsort=1&> TSDATEtype=date]>>> Any help much appreciated, I'm sure its something silly. This code is> just> returning all records for that user.>> Cheers>> Steve Craig>-- 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 toWeb Archive of this list is at: http://webdna.smithmicro.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:
|
- Re: Date Help - Searching the same field twice ( "Scott Anderson" 2004)
|
There is a way to search the same field twice, using the GROUP field featureto create an alias. For example:[search db=admin/-Timesheets.db&eqTSUserNamedatarq=[username]&GROUP1field=TSDATE&GROUP1type=date&geTSDATEdatarq=[SDate]&lsGROUP1datarq=[EDate]&asTSDATEsort=1&TSDATEtype=date]-----Original Message-----From: WebDNA Talk [mailto:WebDNA-Talk@talk.smithmicro.com]On Behalf OfBrian FriesSent: Friday, February 27, 2004 8:54 AMTo: WebDNA TalkSubject: Re: Date HelpSome of this has been said by others, but I'll clarify four points onyour issue:1) I assume you have your WebDNA preferences set properly for UK dateformats. If not, it won't work properly.2) [math date] will return the value as a date in the format specifiedin preferences, BUT, the math variable being set inside the mathcontext is actually holding the "days since 31Dec0000" value. You cansee this by displaying your SDate or EDate variables outside of themath context. Math variables can only hold numbers, and 01/02/2004 isnot a number. To set a variable with the formatted date, you could use:[text]SDate=[math date]{01/[date %m]/[date %Y]}[/math][/text]3) You cannot directly search the same database field twice in a searchcontext - doing both a "geTSDatedatarq" and a "lsTSDatedatarq" in thesame search, one of them will be ignored. In this case, a range searchwould be your answer:....rnTSDatedatarq=[SDate]+[EDate]...4) If you want a strict by-date sort, you should add "&allhit=1" toyour search string. This will disable WebDNA's best-match sorting.Otherwise your date sort will be secondary to WebDNA's best-match sort- records WebDNA considers to be equally ranked will be sorted by date.It may not make a difference in your case, as WebDNA may consider allfound records to be equally ranked, but it is good practice wheneveryou want a specific sort sequence.- brianOn Feb 27, 2004, at 6:55 AM, Steve Craig wrote:> Hi>> OK, I am officially going off my head. I have re-used a piece of> otherwise> working code and it's not working and I cannot see why. Basically I> want to> return the timesheet records a given user for the current month. The> records> have a field called TSDATE which is in dd/mm/yyyy (UK Format). I know I> could save these as numbers but would prefer to work in this format.>> (I have put a return in after each & in the search string to save any> funny> returns from the email.)>> [math date]SDate={01/[date %m]/[date %Y]}[/math] -> 01/02/2004> [math date]EDate={01/[date %m]/[date %Y]}+{00/01/0000}[/math] -> 01/03/2004>> [search db=admin/-Timesheets.db&> eqTSUserNamedatarq=[username]&> geTSDATEdatarq=[SDate]&> lsTSDATEdatarq=[EDate]&> asTSDATEsort=1&> TSDATEtype=date]>>> Any help much appreciated, I'm sure its something silly. This code is> just> returning all records for that user.>> Cheers>> Steve Craig>-- 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 toWeb Archive of this list is at: http://webdna.smithmicro.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/
"Scott Anderson"
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:
Re:No Data (1997)
Blowback and budgets. (2000)
[Announce]: Web server security and password protection (1997)
Running 2 two WebCatalog.acgi's (1996)
2nd WebCatalog2 Feature Request (1996)
Web Catalog and Net Cloak (1998)
Weird Math and SV Bad News (1997)
Protecting webdelivery (1997)
Close Databases Crash? (1998)
WebCat2b15MacPlugIn - [authenticate] not [protect] (1997)
Freeze (2003)
windows file upload = weirdness (2004)
japanese characters (1997)
Multiple prices (1997)
Frames and WebCat (1997)
WebCat2b15MacPlugin - showing [math] (1997)
Umm...about those log files? (Off Topic) (1997)
Beta Documentation (1997)
all records returned. (1997)
Math (1997)