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:

can WC render sites out? (1997) Tab Charactor (1997) apache 1.3.29, WebCat 4.5.1 , RH Linux - using the (2004) [WebDNA] lookup in tables defined in functions - =?UTF-8?Q?bug=3F?= (2016) [WebDNA] WebDNA staging server (2008) carriage returns in data (1997) Search String (2003) RE: protect tag on NT (1997) WebCat and Personal Web Server (1998) View order not right (1997) I'm tired of all this! (2000) Global variables are not always global ... (2000) OH MY GOD! (1998) Configuring E-mail (1997) OT: 800x600 (2003) Copyright ? (1997) http or https (2005) select multiple (1997) [protect admin] (1997) Generating Report Totals (1997)