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. --------------020403080708050403050208 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-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 > 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 --------------020403080708050403050208 Content-Type: text/html; charset=ISO-8859-1 Content-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 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]
<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:

    
  1. Re: [WebDNA] [IF] comparing numeric values - FIGURED OUT (Steve Raslevich 2010)
This is a multi-part message in MIME format. --------------020403080708050403050208 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-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 > 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 --------------020403080708050403050208 Content-Type: text/html; charset=ISO-8859-1 Content-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 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]
<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:

WebCatalog-NT?'s (1996) Where is f2? (1997) WebMerchant 1.6 and https (1997) OS X problem: when using [ShowCart] or [orderfile]... (2000) Clickable maps and WebCatalog? (1996) Nested tags count question (1997) too many nested ... problem (1997) [WebDNA] multi hyperlinks in text paragraphs (2014) WebCat2 - storing unformatted date data? (1997) no global [username] or [password] displayed ... (1997) no global [username] or [password] displayed ... (1997) Displaying photo attached to first record (1997) Explorer 3.0 (1997) MATH (1998) Cart# (1997) default value from Lookup (was Grant, please help me) (1997) Feature Request: ! character bug correct in [showif (2000) RePost: NAT and the CART (1999) WCS Newbie question (1997) SERIAL NUMBER PROBLEM *AGAIN*!!! (1998)