[ic] How to Access the value of [] in a test
Marty Tennison
interchange-users@interchange.redhat.com
Tue May 7 19:38:01 2002
On Tue, 2002-05-07 at 15:05, Xavier de GELIS wrote:
> I checked the [if] documentation but I cannot find a way to properly test
> the subtotal value:
>
> [if value subtotal != 0]
> ..........
> [else]
> ..........
> [/else]
> [/if]
>
> What is the right syntax to do that ?
> Thanks !
Interchange automaticaly formats [subtotal] as a currency. You'll need
to get rid of the fomating before you can check it's value.
Example: assume subtotal contains 5.00
[subtotal] prints $5.00
[subtotal noformat=1] prints 5.00
One (of many) ways to check the value is....
[if base=name term="[subtotal noformat=1]" op="!=" compare="0"]
It's not equal to 0
[else]
It is equal to 0
[/else]
[/if]
Onother way might be to set a scratch variable and check that.
[tmp some_var][subtotal noformat=1][/tmp]
[if scratch some_var != 0]
It's not equal to 0
[else]
It is equal to 0
[/else]
[/if]