Re: Negative number search

This WebDNA talk-list message is from

2000


It keeps the original formatting.
numero = 28596
interpreted = N
texte = >I need to search on a field that has negative numbers in it. >I am looking for a search range from -20 to 0 but I can not seem to >get it to work. >Here is what I have tried: > >[search db=/database.db&rnSEARCH_FIELDdatarq=-20 0&SEARCH_FIELD >type=num&OTHER_FIELD sort=1] > >[search db=/database.db&rnSEARCH_FIELDdatarq=[math]-20[/math] >0&SEARCH_FIELD type=num&OTHER_FIELD sort=1] > > > > >I even tried this to see if I could get a negative number recognized, >but it only brought back results higher than +20 > >[search db=/database.db&geSEARCH_FIELDdatarq=-20&SEARCH_FIELD >type=num&OTHER_FIELD sort=1] I think webcat only deals with whole numbers, so it sees them all as unsigned values, which makes them all 'positive' instead of some positive and some negative.Here's a solution, add a NEWNUM field to the db, then write an admin template that runs thru the db and replaces the value in the NEWNUM field with the value of SEARCH_FIELD plus XXX.The value of XXX will have to be greater than the absolute value of the smallest negative value in the db, so if the smallest negative value is -99 then add 100. Then in your search parameters, compare the values in the NEWNUM field instead of SEARCH_FIELD field.Maybe there's an easier way, but this will work as long as you remember to also write a value to the NEWNUM field after every append or replace ... :)================================ Kenneth Grome, WebDNA Consultant 808-737-6499 http://webdna.net ================================------------------------------------------------------------- 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 Associated Messages, from the most recent to the oldest:

    
  1. Re: Negative number search (Paul Fowler 2000)
  2. Re: Negative number search (Kenneth Grome 2000)
  3. Negative number search (Paul Fowler 2000)
>I need to search on a field that has negative numbers in it. >I am looking for a search range from -20 to 0 but I can not seem to >get it to work. >Here is what I have tried: > >[search db=/database.db&rnSEARCH_FIELDdatarq=-20 0&SEARCH_FIELD >type=num&OTHER_FIELD sort=1] > >[search db=/database.db&rnSEARCH_FIELDdatarq=[math]-20[/math] >0&SEARCH_FIELD type=num&OTHER_FIELD sort=1] > > > > >I even tried this to see if I could get a negative number recognized, >but it only brought back results higher than +20 > >[search db=/database.db&geSEARCH_FIELDdatarq=-20&SEARCH_FIELD >type=num&OTHER_FIELD sort=1] I think webcat only deals with whole numbers, so it sees them all as unsigned values, which makes them all 'positive' instead of some positive and some negative.Here's a solution, add a NEWNUM field to the db, then write an admin template that runs thru the db and replaces the value in the NEWNUM field with the value of SEARCH_FIELD plus XXX.The value of XXX will have to be greater than the absolute value of the smallest negative value in the db, so if the smallest negative value is -99 then add 100. Then in your search parameters, compare the values in the NEWNUM field instead of SEARCH_FIELD field.Maybe there's an easier way, but this will work as long as you remember to also write a value to the NEWNUM field after every append or replace ... :)================================ Kenneth Grome, WebDNA Consultant 808-737-6499 http://webdna.net ================================------------------------------------------------------------- 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 Kenneth Grome

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:

WebCat2b12plugin - [search] is broken ... not! (1997) ThisURL and getting domain/server address (2005) inside out... how much? (2004) Transferring textareas (1997) Nested vs conditional (1997) (OT) Support system (2000) WebCat2b12 Mac.acgi--[searchstring] bug (1997) [WebDNA] bulk e-mail (2011) Logging purchases (1997) How to append text after the sign & (1997) Summary search -- speed (1997) Freeze (2003) WebCat website for developers and hosters (2001) RequiredFields and MacOS X Server? (2000) Opinion: [input] should be called [output] ... (1997) Random bug, OSX 10.04 (2001) Smart caching problems with 2.1b3? (1997) Runtime version ... (2003) Re:trouble (1997) Showing unopened cart (1997)