Appending with +1 ...
This WebDNA talk-list message is from 1997
It keeps the original formatting.
numero = 14367
interpreted = N
texte = >Hi,>>I have looked over the past mailings to webcat and I didn't see your db>solution. Could you please resend it directly to me?Hi Kevin,I can't find it either, so I'll write it again:[append db=XXX.db]YYY=[math][searchdb=XXX.db&neYYYdata=[blank]&deYYYsort=1&YYYtype=num&max=1][founditems][YYY][/founditems][/search]+1[/math][/append]Here's what it does. The search context finds all the records in theXXX database that have something (not blank) in the YYY field, thenit sorts those records in reverse chronological order so that therecord with the largest number in the YYY field is at the top of theresults list.Then the Max=1 parameter makes WebCat display only the first recordin that list, which is the one with the largest value in the YYYfield, right?Then the [math] context adds 1 to the value of that YYY field, thuscreating a value of (YYY+1) inside the [math] context. This value isalways going to be one whole number larger than the highest number inthe YYY field in all the records in the database.Then the [append] context creates a new record in the XXX database,and it sets the value in the YYY field in this new record to thevalue inside the [math] context, which is one higher thanthe*previous* high value.That's all ... :)The only thing you have to make sure to do is to NEVER allow anyoneto put any values other than NUMBERS into the YYY field. Of course,this should never be a problem if you don't let anyone change thesevalues from a form, or manually by directly accessing the database.Sincerely, Ken GromeWebDNA Solutionshttp://www.smithmicro.com/webdnasolutions/.
Associated Messages, from the most recent to the oldest:
>Hi,>>I have looked over the past mailings to webcat and I didn't see your db>solution. Could you please resend it directly to me?Hi Kevin,I can't find it either, so I'll write it again:[append db=XXX.db]YYY=
[math][searchdb=XXX.db&neYYYdata=[blank]&deYYYsort=1&YYYtype=num&max=1]
[founditems][YYY][/founditems][/search]+1[/math][/append]Here's what it does. The search context finds all the records in theXXX database that have something (not blank) in the YYY field, thenit sorts those records in reverse chronological order so that therecord with the largest number in the YYY field is at the top of theresults list.Then the Max=1 parameter makes WebCat display only the first recordin that list, which is the one with the largest value in the YYYfield, right?Then the
[math] context adds 1 to the value of that YYY field, thuscreating a value of (YYY+1) inside the
[math] context. This value isalways going to be one whole number larger than the highest number inthe YYY field in all the records in the database.Then the
[append] context creates a new record in the XXX database,and it sets the value in the YYY field in this new record to thevalue inside the
[math] context, which is one higher thanthe*previous* high value.That's all ... :)The only thing you have to make sure to do is to NEVER allow anyoneto put any values other than NUMBERS into the YYY field. Of course,this should never be a problem if you don't let anyone change thesevalues from a form, or manually by directly accessing the database.Sincerely, Ken GromeWebDNA Solutionshttp://www.smithmicro.com/webdnasolutions/.
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:
No Access warning when caching HTML files (1997)
Re:Help name our technology! (1997)
Date Time Oddness (1999)
OT: Where to turn (2003)
Searching Numbers (2004)
Template Encryption (1998)
WebCat2_Mac RETURNs in .db (1997)
PSC recommends what date format yr 2000??? (1997)
WebCat2 - many [carts] on one template page? (1997)
Webcat 2.0.1 date math bug -> Crash! (1997)
problems with 2 tags shakur (1997)
Two stores, one server (1998)
WebCat2b13MacPlugin - [math][date][/math] problem (1997)
Renaming DB fields (2000)
WebCatalog can't find database (1997)
Question about links (1999)
page redirect in webDNA (1997)
Filemaker Pro & Webcatalog (1999)
suffix mapping, use of cache, etc. (1997)
Template Security error (1997)