Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

amper variables as numeric

Status
Not open for further replies.

LPGAST

Programmer
Jun 4, 2004
10
US
HI Guys, Iam trying to create a amper variable to substitute the BY HIGHEST verb in my fex but it's not working for me....

I use this code before my define table
Code:
-* SET 
-SET &TOP_# = IF &TOP_N.EVAL GT '0O' THEN &TOP_N ELSE   &TOP_N.EVAL * -1;
-SET &BY_BY = IF EDIT(&TOP_N.EVAL) GT 'O0' THEN 'BY HIGHEST ' ELSE  'BY LOWEST ';
-SET &HI_LO = &BY_BY | '&TOP_#.EVAL' | ' TOTAL TY_MTD NOPRINT' ;
-? &HI_LO

no matter what I try it only takes the else clause, how do you evaluate amper varibales as numeric?
 
Hi,
I think u have a zero number first and then the O letter.
It might be the problem...

oz
 
Yeah, it was one of them...but I think that may have happened after the initial error and I started playing the syntax. What I think may have been the problem is for some reason or the other it didn't like my expression in the else clause. I changed it to use the ABS function, fixed the typo it worked fine..
 
Try just setting the amper variable without the quotes to treat it as numeric.

-SET &NUM1 = '2' ; ---> CHARACTER

-SET &NUM2 = 2 ; ----> NUMBER



THEN, evaluate the amper var against a NON-quoted number.
0 instead of '0'. This is treating it as an actual number zero instead of character zero.

-SET &BY_BY = IF EDIT(&TOP_N.EVAL) GT 0 THEN 'BY HIGHEST ' ELSE 'BY LOWEST ';

Hope that helps.



 
Actually, whether the value is in quotes or not has no bearing on what is stored. ALL variables in Dialogue Manager are stored as character strings. It's when they're used that a determination is made, as to how to treat them (numbers versus character strings).

You can see this if you type out &variable.TYPE; if &variable can be treated as a number, the .TYPE value is 'N'; if a character string, it displays 'A'.

It seems you want to test on whether a value has been set or not. To do that, use the .EXISTS qualifier. &variable.EXISTS will be 1 (true) if &variable has a value, and 0 (false) if not.
 
NO, what I was trying to do was have the user enter a numerical value and then set the LOWEST or HIGHEST Clause based on the value entered.

It has been solved, so don't go crazy, it was mainly a syntax error.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top