Re: [WebDNA] [thisautonumber] and [lastautonumber]
This WebDNA talk-list message is from 2011
It keeps the original formatting.
numero = 106592
interpreted = N
texte = --Apple-Mail-17--361261955Content-Transfer-Encoding: quoted-printableContent-Type: text/plain;charset=windows-1252The answers provided were close, but not quite right=85.[thisautonumber] gives you access to the autonumber value that is =currently being added, from inside the [append] or [replace] context.[lastautonumber] gives you access to the autonumber value that was used =the previous time that autonumber was invoked, after leaving the =[append] or [replace] content.As a simple demonstration, run this code:[table name=3DmyTable&fields=3Dkey,thisNumber,lastNumber][/table][loop start=3D1&end=3D5][append =table=3DmyTable&autonumber=3Dkey]thisNumber=3D[thisautonumber]&lastNumber=3D=[lastautonumber][/append]Appended number [lastautonumber]
[/loop]
Key | This Number | Last Number |
[search table=3DmyTable&nekeydatarq=3D[blank]&rank=3Doff][founditems][key] | [thisNumber] | [lastNumber] |
[/founditems][/search]
This gives the results:Appended number 1Appended number 2Appended number 3Appended number 4Appended number 5KeyThis NumberLast Number11=09221332443554Brian FriesBrainScan SoftwareOn Apr 29, 2011, at 10:28 AM, Steve Raslevich - Northern Sound & Light =wrote:> Aaron>=20> Thanks for the example on how to place [lastautonumber] within an =[append]. I do use [autonumber] a lot.=20>=20> Do you have any idea then what the difference is between =[LASTautonumber] and [THISautonumber] is?>=20> Steve>=20>=20>=20> Aaron Michael Kaczmarek wrote:>>=20>> I actually discovered the autonumber feature relatively recently (how =did I miss this before?). [lastautonumber] and [thisautonumber] are =only available inside of the [append] context, so a code should look =something like this..>>=20>> [append =db=3Dyour.db&autonumber=3DIDfield]var1=3D[var1]&var2=3D[var3][text]lastID=3D=[lastAutonumber][/text][/append]>>=20>> autonumbers are generated as simple numerical increments of 1 - the =first record will be given a value of "1", the next "2", and so on. If =you need to create record IDs in a custom format, I don't think this =will work. =20>>=20>>=20>>=20>> On 4/28/11 3:21 PM, Steve Raslevich -Northern Sound & Light wrote:>>>=20>>> Hi,>>>=20>>> Can anyone give me a sample of the syntax on how to use =[thisautonumber] and/or [lastautonumber] to assign it to a text or math =variable? I want to [append] to a db using "autonumber" and then use =that same autonumber within a replace further down my template.>>>=20>>> All I found in the online documentation was this:>>>=20>>> You can use [thisautonumber] tag from within an [append] or =[replace] context, to retrieve the current auto-generated number (if the =AUTONUMBER parameter was used).>>>=20>>>=20>>>=20>>> Is the code below safe to use with a heavily appended database?>>>=20>>> [append db=3D../../data/sku.db&autonumber=3DSEQNUM][formvariables =name=3D_&exact=3DF][getchars =start=3D2][name][/getchars]=3D[url][value][/url]&[/formvariables][/append]=>>> [text]_sku=3D[lastautonumber][/text]>>>=20>>> Thanks,>>> Steve--Apple-Mail-17--361261955Content-Transfer-Encoding: quoted-printableContent-Type: text/html;charset=windows-1252
The answers provided were close, but not quite =right=85.
[thisautonumber] gives you access to =the autonumber value that is currently being added, from inside the =[append] or [replace] context.
[lastautonumber] =gives you access to the autonumber value that was used the previous time =that autonumber was invoked, after leaving the [append] or [replace] =content.
As a simple =demonstration, run this code:
[table name=3DmyTable&fields=3Dkey,thisNumber,lastNumber][/tabl=e][loop start=3D1&end=3D5][append =table=3DmyTable&autonumber=3Dkey]thisNumber=3D[thisautonumber]&las=tNumber=3D[lastautonumber][/append]Appended number [lastautonumber]<br>[/loop]<table border=3D"1" cellspacing=3D"0"><tr><th>Key</th><th>This =Number</th><th>Last Number</th></tr>[search table=3DmyTable&nekeydatarq=3D[blank]&rank=3Doff][foundite=ms]=<tr><td>[key]</td><td>[thisNumber]</td><t=d>[lastNumber]</td></tr>[/founditems][/search]</table>
This gives the =results:
Appended number 1
Appended number 2
Appended number =3
Appended number 4
Appended number 5
Key | This Number | Last =Number |
---|
1 | 1 | |
2 | 2 | 1 |
3 | 3 | 2 |
4 | 4 | 3 |
5 | 5 | 4
|
=
Brian =Fries
BrainScan =Software
On Apr 29, 2011, at 10:28 AM, Steve Raslevich - Northern =Sound & Light wrote:
Aaron
Thanks for the example on how to place [lastautonumber] within an[append]. I do use [autonumber] a lot.
Do you have any idea then what the difference is between[LASTautonumber] and [THISautonumber] is?
Steve
Aaron Michael Kaczmarek wrote:
=20 =20I actually discovered the autonumber feature relatively recently (howdid I miss this before?). [lastautonumber] and [thisautonumber] =areonly available inside of the [append] context, so a code should looksomething like this..
[append=db=3Dyour.db&autonumber=3DIDfield]var1=3D[var1]&var2=3D[var3][text=]lastID=3D[lastAutonumber][/text][/append]
autonumbers are generated as simple numerical increments of 1 - thefirst record will be given a value of "1", the next "2", and so =on. Ifyou need to create record IDs in a custom format, I don't think thiswill work.
On 4/28/11 3:21 PM, Steve Raslevich -Northern Sound & Light wrote: Hi,
Can anyone give me a sample of the syntax on how to use[thisautonumber] and/or [lastautonumber] to assign it to a text or mathvariable? I want to [append] to a db using "autonumber"and then use that same autonumber within a replace further down mytemplate.
All I found in the online documentation was this:
You can use [thisautonumber] tag from within an [append] or [replace]context, to retrieve the current auto-generated number (if theAUTONUMBER parameter was used).
Is the code below safe to use with a heavily appended database?
[append db=3D../../data/sku.db&autonumber=3DSEQNUM][formvariablesname=3D_&exact=3DF][getchars=start=3D2][name][/getchars]=3D[url][value][/url]&[/formvariables][/app=end]
[text]_sku=3D[lastautonumber][/text]
Thanks,
=Steve
=--Apple-Mail-17--361261955--
Associated Messages, from the most recent to the oldest:
--Apple-Mail-17--361261955Content-Transfer-Encoding: quoted-printableContent-Type: text/plain;charset=windows-1252The answers provided were close, but not quite right=85.[thisautonumber] gives you access to the autonumber value that is =currently being added, from inside the
[append] or
[replace] context.
[lastautonumber] gives you access to the autonumber value that was used =the previous time that autonumber was invoked, after leaving the =
[append] or
[replace] content.As a simple demonstration, run this code:[table name=3DmyTable&fields=3Dkey,thisNumber,lastNumber][/table][loop start=3D1&end=3D5][append =table=3DmyTable&autonumber=3Dkey]thisNumber=3D[thisautonumber]&lastNumber=3D=
[lastautonumber][/append]Appended number
[lastautonumber][/loop]
Key | This Number | Last Number |
[search table=3DmyTable&nekeydatarq=3D[blank]&rank=3Doff][founditems][key] | [thisNumber] | [lastNumber] |
[/founditems][/search]
This gives the results:Appended number 1Appended number 2Appended number 3Appended number 4Appended number 5KeyThis NumberLast Number11=09221332443554Brian FriesBrainScan SoftwareOn Apr 29, 2011, at 10:28 AM, Steve Raslevich - Northern Sound & Light =wrote:> Aaron>=20> Thanks for the example on how to place
[lastautonumber] within an =
[append]. I do use [autonumber] a lot.=20>=20> Do you have any idea then what the difference is between =
[lastautonumber] and [THISautonumber] is?>=20> Steve>=20>=20>=20> Aaron Michael Kaczmarek wrote:>>=20>> I actually discovered the autonumber feature relatively recently (how =did I miss this before?).
[lastautonumber] and [thisautonumber] are =only available inside of the
[append] context, so a code should look =something like this..>>=20>> [append =db=3Dyour.db&autonumber=3DIDfield]var1=3D[var1]&var2=3D[var3]
[text]lastID=3D=
[lastautonumber][/text][/append]>>=20>> autonumbers are generated as simple numerical increments of 1 - the =first record will be given a value of "1", the next "2", and so on. If =you need to create record IDs in a custom format, I don't think this =will work. =20>>=20>>=20>>=20>> On 4/28/11 3:21 PM, Steve Raslevich -Northern Sound & Light wrote:>>>=20>>> Hi,>>>=20>>> Can anyone give me a sample of the syntax on how to use =[thisautonumber] and/or
[lastautonumber] to assign it to a text or math =variable? I want to
[append] to a db using "autonumber" and then use =that same autonumber within a replace further down my template.>>>=20>>> All I found in the online documentation was this:>>>=20>>> You can use [thisautonumber] tag from within an
[append] or =
[replace] context, to retrieve the current auto-generated number (if the =AUTONUMBER parameter was used).>>>=20>>>=20>>>=20>>> Is the code below safe to use with a heavily appended database?>>>=20>>> [append db=3D../../data/sku.db&autonumber=3DSEQNUM][formvariables =name=3D_&exact=3DF][getchars =start=3D2][name][/getchars]=3D
[url][value][/url]&[/formvariables][/append]=>>>
[text]_sku=3D
[lastautonumber][/text]>>>=20>>> Thanks,>>> Steve--Apple-Mail-17--361261955Content-Transfer-Encoding: quoted-printableContent-Type: text/html;charset=windows-1252
The answers provided were close, but not quite =right=85.
[thisautonumber] gives you access to =the autonumber value that is currently being added, from inside the =
[append] or
[replace] context.
[lastautonumber] =gives you access to the autonumber value that was used the previous time =that autonumber was invoked, after leaving the
[append] or
[replace] =content.
As a simple =demonstration, run this code:
[table name=3DmyTable&fields=3Dkey,thisNumber,lastNumber][/tabl=e][loop start=3D1&end=3D5][append =table=3DmyTable&autonumber=3Dkey]thisNumber=3D[thisautonumber]&las=tNumber=3D[lastautonumber][/append]Appended number [lastautonumber]<br>[/loop]<table border=3D"1" cellspacing=3D"0"><tr><th>Key</th><th>This =Number</th><th>Last Number</th></tr>[search table=3DmyTable&nekeydatarq=3D[blank]&rank=3Doff][foundite=ms]=<tr><td>[key]</td><td>[thisNumber]</td><t=d>[lastNumber]</td></tr>[/founditems][/search]</table>
This gives the =results:
Appended number 1
Appended number 2
Appended number =3
Appended number 4
Appended number 5
Key | This Number | Last =Number |
---|
1 | 1 | |
2 | 2 | 1 |
3 | 3 | 2 |
4 | 4 | 3 |
5 | 5 | 4
|
=
Brian =Fries
BrainScan =Software
On Apr 29, 2011, at 10:28 AM, Steve Raslevich - Northern =Sound & Light wrote:
Aaron
Thanks for the example on how to place
[lastautonumber] within an
[append]. I do use [autonumber] a lot.
Do you have any idea then what the difference is between
[lastautonumber] and [THISautonumber] is?
Steve
Aaron Michael Kaczmarek wrote:
=20 =20I actually discovered the autonumber feature relatively recently (howdid I miss this before?). [lastautonumber] and [thisautonumber] =areonly available inside of the [append] context, so a code should looksomething like this..
[append=db=3Dyour.db&autonumber=3DIDfield]var1=3D[var1]&var2=3D[var3][text=]lastID=3D[lastautonumber][/text][/append]
autonumbers are generated as simple numerical increments of 1 - thefirst record will be given a value of "1", the next "2", and so =on. Ifyou need to create record IDs in a custom format, I don't think thiswill work.
On 4/28/11 3:21 PM, Steve Raslevich -Northern Sound & Light wrote: Hi,
Can anyone give me a sample of the syntax on how to use[thisautonumber] and/or [lastautonumber] to assign it to a text or mathvariable? I want to [append] to a db using "autonumber"and then use that same autonumber within a replace further down mytemplate.
All I found in the online documentation was this:
You can use [thisautonumber] tag from within an [append] or [replace]context, to retrieve the current auto-generated number (if theAUTONUMBER parameter was used).
Is the code below safe to use with a heavily appended database?
[append db=3D../../data/sku.db&autonumber=3DSEQNUM][formvariablesname=3D_&exact=3DF][getchars=start=3D2][name][/getchars]=3D[url][value][/url]&[/formvariables][/app=end]
[text]_sku=3D[lastautonumber][/text]
Thanks,
=Steve
=--Apple-Mail-17--361261955--
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:
WebCatalog Plug-in for Webstar. (1997)
Tip O' the Week (1996)
Generating unique SKU from [cart] - Still Stumped... (1997)
Sort of a Dilema! (1998)
weird happenings (1997)
Frames and WebCat (1997)
RE: [WebDNA] Help me install (WebDNA 7 fastcgi install on Lion (2012)
OT: Portland Oregon (2002)
Fields/Forms Processing (1998)
[WebDNA] 2nd pair of eyes on redirect please (2011)
Payfuse? (2006)
Authenticate (1997)
Weird happenings when viewing in IE 3.02 (1998)
Listfiles path bug ... (2005)
with Link i need to (1997)
no global [username] or [password] displayed ... (1997)
Max Record length restated as maybe bug (1997)
Multiple Merchant Accounts? (1997)
[TaxableTotal] - not working with AOL and IE (1997)
READFILE command? (1998)