-
Notifications
You must be signed in to change notification settings - Fork 0
Using less than or greater than in DEFINE ASSIGN Statements
jason nemecek edited this page Oct 3, 2017
·
1 revision
- Overview
A issue occurs in NASIS reports when using less than or greater than in DEFINE/ASSIGN statements no matter how the fields are casted or converted.
- Problem
e.g. DEFINE test IF Day_Distribution_date < 10 THEN Yes” ELSE No”.
Let’s say Day_Distribution_date = 2.
IF 2 < 10 THEN “Yes” ELSE “No”. The answer should be “Yes” but it comes out as “No”
-
Solution
DEFINE test IF Day_Distribution_date + 0 < 10 + 0 THEN Yes” ELSE No”. Day_Distribution_date = 2. Answer is “Yes”
NASIS report generator interprets all expressions in the Select clause as strings, even if they are cast to numeric. The report generator is not able to determine the result type of an expression so it has to assume the most general case.
If you need to use the result of a select expression as a number it can be forced to numeric type by using it in a numeric expression in a DEFINE/ASSIGN statement, such as ASSIGN x x + 0.