Re: [WebDNA] [IF] comparing numeric values - FIGURED OUT
This WebDNA talk-list message is from 2010
It keeps the original formatting.
numero = 105672
interpreted = N
texte = This is a multi-part message in MIME format.--------------020403080708050403050208Content-Type: text/plain; charset=ISO-8859-1; format=flowedContent-Transfer-Encoding: 7bitI finally found some documentation and I removed the " quotation marks.Sorry for the filling your in box with this.Thanks,SteveSteve Raslevich wrote:> Hi>> Can someone look at this and tell me if I have the syntax correct in > my [IF] statement?>> I have a simple table with 20 records containing a record id number > and a numeric cost value. I want to verify that each cost in the next > higher serialized field has a higher value than the current record > being listed in a [founditems]. I have entered form variables that are > in the correct value order however the output shows an error when > comparing record #18 within the [IF] statement>> Here is the code:>> [table name=check&fields=idn,cost]> 1 [_COST1]> 2 [_COST2]> 3 [_COST3]> 4 [_COST4]> 5 [_COST5]> 6 [_COST6]> 7 [_COST7]> 8 [_COST8]> 9 [_COST9]> 10 [_COST10]> 11 [_COST11]> 12 [_COST12]> 13 [_COST13]> 14 [_COST14]> 15 [_COST15]> 16 [_COST16]> 17 [_COST17]> 18 [_COST18]> 19 [_COST19]> 20 [_COST20]> [/table]>> [search table=check&lsIDNdatarq=20&IDNtype=num&IDNsort=1]> [founditems]> [text]error=pass[/text]> [math show=f]nextsn=[idn]+1[/math]> [math show=f]costb=[lookup > table=check&value=[nextsn]&LookInField=idn&ReturnField=cost][/math]> [if > ("[math][costb][/math]"<"[math][cost][/math]")][then][text]error=Cost > Error on line [nextsn][/text][/then][/if]>
ID#:[idn] - cost:[cost] - costb:[costb]> [showif [error]!pass]>
[error]> [/showif]> [/founditems]> [/search]>> COSTB should always be greater than COST and they all are however the > [IF] is returning the wrong result for line/record 18>> IDN:1 - cost:10.99 - costb:20> IDN:2 - cost:20 - costb:25> IDN:3 - cost:25 - costb:30> IDN:4 - cost:30 - costb:35> IDN:5 - cost:35 - costb:40> IDN:6 - cost:40 - costb:45> IDN:7 - cost:45 - costb:50> IDN:8 - cost:50 - costb:55> IDN:9 - cost:55 - costb:58> IDN:10 - cost:58 - costb:60> IDN:11 - cost:60 - costb:65> IDN:12 - cost:65 - costb:70> IDN:13 - cost:70 - costb:75> IDN:14 - cost:75 - costb:78> IDN:15 - cost:78 - costb:80> IDN:16 - cost:80 - costb:95> IDN:17 - cost:95 - costb:100> Cost Error on line 18> IDN:18 - cost:100 - costb:110> IDN:19 - cost:110 - costb:1500>> Thanks,> Steve--------------020403080708050403050208Content-Type: text/html; charset=ISO-8859-1Content-Transfer-Encoding: 7bit
I finally found some documentation and I removed the " quotation marks.
Sorry for the filling your in box with this.
Thanks,
Steve
Steve Raslevich wrote:
Hi
Can someone look at this and tell me if I have the syntax correct in my[IF] statement?
I have a simple table with 20 records containing a record id number anda numeric cost value. I want to verify that each cost in the nexthigher serialized field has a higher value than the current recordbeing listed in a [founditems]. I have entered form variables that arein the correct value order however the output shows an error whencomparing record #18 within the [IF] statement
Here is the code:
[table name=check&fields=idn,cost]
1 [_COST1]
2 [_COST2]
3 [_COST3]
4 [_COST4]
5 [_COST5]
6 [_COST6]
7 [_COST7]
8 [_COST8]
9 [_COST9]
10 [_COST10]
11 [_COST11]
12 [_COST12]
13 [_COST13]
14 [_COST14]
15 [_COST15]
16 [_COST16]
17 [_COST17]
18 [_COST18]
19 [_COST19]
20 [_COST20]
[/table]
[search table=check&lsIDNdatarq=20&IDNtype=num&IDNsort=1]
[founditems]
[text]error=pass[/text]
[math show=f]nextsn=[idn]+1[/math]
[math show=f]costb=[lookuptable=check&value=[nextsn]&LookInField=idn&ReturnField=cost][/math]
[if("[math][costb][/math]"<"[math][cost][/math]")][then][text]error=CostError on line [nextsn][/text][/then][/if]
<br>ID#:[idn] - cost:[cost] - costb:[costb]
[showif [error]!pass]
<br><font class="style15">[error]</font>
[/showif]
[/founditems]
[/search]
COSTB should always be greater than COST and they all are however the[IF] is returning the wrong result for line/record 18
IDN:1 - cost:10.99 - costb:20
IDN:2 - cost:20 - costb:25
IDN:3 - cost:25 - costb:30
IDN:4 - cost:30 - costb:35
IDN:5 - cost:35 - costb:40
IDN:6 - cost:40 - costb:45
IDN:7 - cost:45 - costb:50
IDN:8 - cost:50 - costb:55
IDN:9 - cost:55 - costb:58
IDN:10 - cost:58 - costb:60
IDN:11 - cost:60 - costb:65
IDN:12 - cost:65 - costb:70
IDN:13 - cost:70 - costb:75
IDN:14 - cost:75 - costb:78
IDN:15 - cost:78 - costb:80
IDN:16 - cost:80 - costb:95
IDN:17 - cost:95 - costb:100
Cost Error on line 18
IDN:18 - cost:100 - costb:110
IDN:19 - cost:110 - costb:1500
Thanks,
Steve
--------------020403080708050403050208--
Associated Messages, from the most recent to the oldest:
|
- Re: [WebDNA] [IF] comparing numeric values - FIGURED OUT (Steve Raslevich 2010)
|
This is a multi-part message in MIME format.--------------020403080708050403050208Content-Type: text/plain; charset=ISO-8859-1; format=flowedContent-Transfer-Encoding: 7bitI finally found some documentation and I removed the " quotation marks.Sorry for the filling your in box with this.Thanks,SteveSteve Raslevich wrote:> Hi>> Can someone look at this and tell me if I have the syntax correct in > my
[if] statement?>> I have a simple table with 20 records containing a record id number > and a numeric cost value. I want to verify that each cost in the next > higher serialized field has a higher value than the current record > being listed in a
[founditems]. I have entered form variables that are > in the correct value order however the output shows an error when > comparing record #18 within the
[if] statement>> Here is the code:>> [table name=check&fields=idn,cost]> 1 [_COST1]> 2 [_COST2]> 3 [_COST3]> 4 [_COST4]> 5 [_COST5]> 6 [_COST6]> 7 [_COST7]> 8 [_COST8]> 9 [_COST9]> 10 [_COST10]> 11 [_COST11]> 12 [_COST12]> 13 [_COST13]> 14 [_COST14]> 15 [_COST15]> 16 [_COST16]> 17 [_COST17]> 18 [_COST18]> 19 [_COST19]> 20 [_COST20]> [/table]>> [search table=check&lsIDNdatarq=20&IDNtype=num&IDNsort=1]>
[founditems]>
[text]error=pass[/text]> [math show=f]nextsn=[idn]+1[/math]> [math show=f]costb=[lookup > table=check&value=[nextsn]&LookInField=idn&ReturnField=cost][/math]> [if > ("
[math][costb][/math]"<"
[math][cost][/math]")][then]
[text]error=Cost > Error on line [nextsn][/text][/then][/if]>
ID#:[idn] - cost:[cost] - costb:[costb]> [showif [error]!pass]>
[error]> [/showif]> [/founditems]> [/search]>> COSTB should always be greater than COST and they all are however the >
[if] is returning the wrong result for line/record 18>> IDN:1 - cost:10.99 - costb:20> IDN:2 - cost:20 - costb:25> IDN:3 - cost:25 - costb:30> IDN:4 - cost:30 - costb:35> IDN:5 - cost:35 - costb:40> IDN:6 - cost:40 - costb:45> IDN:7 - cost:45 - costb:50> IDN:8 - cost:50 - costb:55> IDN:9 - cost:55 - costb:58> IDN:10 - cost:58 - costb:60> IDN:11 - cost:60 - costb:65> IDN:12 - cost:65 - costb:70> IDN:13 - cost:70 - costb:75> IDN:14 - cost:75 - costb:78> IDN:15 - cost:78 - costb:80> IDN:16 - cost:80 - costb:95> IDN:17 - cost:95 - costb:100> Cost Error on line 18> IDN:18 - cost:100 - costb:110> IDN:19 - cost:110 - costb:1500>> Thanks,> Steve--------------020403080708050403050208Content-Type: text/html; charset=ISO-8859-1Content-Transfer-Encoding: 7bit
I finally found some documentation and I removed the " quotation marks.
Sorry for the filling your in box with this.
Thanks,
Steve
Steve Raslevich wrote:
Hi
Can someone look at this and tell me if I have the syntax correct in my[if] statement?
I have a simple table with 20 records containing a record id number anda numeric cost value. I want to verify that each cost in the nexthigher serialized field has a higher value than the current recordbeing listed in a [founditems]. I have entered form variables that arein the correct value order however the output shows an error whencomparing record #18 within the [if] statement
Here is the code:
[table name=check&fields=idn,cost]
1 [_COST1]
2 [_COST2]
3 [_COST3]
4 [_COST4]
5 [_COST5]
6 [_COST6]
7 [_COST7]
8 [_COST8]
9 [_COST9]
10 [_COST10]
11 [_COST11]
12 [_COST12]
13 [_COST13]
14 [_COST14]
15 [_COST15]
16 [_COST16]
17 [_COST17]
18 [_COST18]
19 [_COST19]
20 [_COST20]
[/table]
[search table=check&lsIDNdatarq=20&IDNtype=num&IDNsort=1]
[founditems]
[text]error=pass[/text]
[math show=f]nextsn=[idn]+1[/math]
[math show=f]costb=[lookuptable=check&value=[nextsn]&LookInField=idn&ReturnField=cost][/math]
[if("[math][costb][/math]"<"[math][cost][/math]")][then][text]error=CostError on line [nextsn][/text][/then][/if]
<br>ID#:[idn] - cost:[cost] - costb:[costb]
[showif [error]!pass]
<br><font class="style15">[error]</font>
[/showif]
[/founditems]
[/search]
COSTB should always be greater than COST and they all are however the[if] is returning the wrong result for line/record 18
IDN:1 - cost:10.99 - costb:20
IDN:2 - cost:20 - costb:25
IDN:3 - cost:25 - costb:30
IDN:4 - cost:30 - costb:35
IDN:5 - cost:35 - costb:40
IDN:6 - cost:40 - costb:45
IDN:7 - cost:45 - costb:50
IDN:8 - cost:50 - costb:55
IDN:9 - cost:55 - costb:58
IDN:10 - cost:58 - costb:60
IDN:11 - cost:60 - costb:65
IDN:12 - cost:65 - costb:70
IDN:13 - cost:70 - costb:75
IDN:14 - cost:75 - costb:78
IDN:15 - cost:78 - costb:80
IDN:16 - cost:80 - costb:95
IDN:17 - cost:95 - costb:100
Cost Error on line 18
IDN:18 - cost:100 - costb:110
IDN:19 - cost:110 - costb:1500
Thanks,
Steve
--------------020403080708050403050208--
Steve Raslevich
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:
[protect] on NT? (1997)
your mail (2000)
AAgghh!! Help, please. SSL strikes again. (1997)
Here's how to kill a Butler Database. (1997)
WebDNA-Talk Digest mode broken (1997)
no [search] with NT (1997)
[WebDNA] WebDNA on a cPanel server? Maybe not ... (2019)
Text Variabels Not Passed To Include (2002)
WebMerchant? (1998)
Enhancement Request for WebCatalog-NT (1996)
Frames and WebCat (1997)
method of payment (1997)
I'm new be kind (1997)
[WriteFile] problems (1997)
WebMerchant Question (1998)
Time for a hard questions. (1997)
[WriteFile] problems (1997)
Visitor info (2000)
Error Log (1998)
Reload adding to cart (2001)