

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ISNUM in script returns FALSE while on the GUI, it's TRUE?
Hi,
I have a line like this in my script
>> LET v_Trace = IF(ISNUM([field]) = -1, 'yes', 'no') <<
Strangely, this returns "no" in the script while on the GUI the same function, applied at the same stage of execution, returns 'yes'.
Can somebody explain this difference to me?
Thanks a lot!
Best regards,
DataNibbler
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Manish Kachhia
Consider below example... This will return as no because not all the values of field is Numeric.
Data:
Load * Inline
[
field
123
ABC
DEF
456
];
LET v_Trace = IF(ISNUM([field]) = -1, 'yes', 'no');
TRACE $(v_Trace);
because, if you pass field name in isnum() outside load and without any field value position - it actually returns a NULL. And null is not numeric. hope that makes sense.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Consider below example... This will return as no because not all the values of field is Numeric.
Data:
Load * Inline
[
field
123
ABC
DEF
456
];
LET v_Trace = IF(ISNUM([field]) = -1, 'yes', 'no');
TRACE $(v_Trace);


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Manish,
this seems logical, the variable considers the entire table, about 250.000 records and if one of them is not numeric, it will turn to 'no'.
But in my instance, ALL the values are numeric - if I try it with a new listbox_object on the GUI, I have the two values -1 and 0, but I cannot select 0.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you share sample file only having this field? also provide how your are using in UI !


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the script, [field] has no value, so IsNum correctly returns False return. In the front end, [field] may contain a single value, and could return True.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Manish Kachhia
Consider below example... This will return as no because not all the values of field is Numeric.
Data:
Load * Inline
[
field
123
ABC
DEF
456
];
LET v_Trace = IF(ISNUM([field]) = -1, 'yes', 'no');
TRACE $(v_Trace);
because, if you pass field name in isnum() outside load and without any field value position - it actually returns a NULL. And null is not numeric. hope that makes sense.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Manish,
that would be somewhat difficult as there is a lot of sensitive data that I'm processing here - and there are a lot of fields - and that field which I want to check has actually already been processed because I get it from Excel and the settings rgd. the decimal_separator are wrong, so I switch it around. I think I remember there was also this "it works for everyone else, so i cannot show how it does not work" effect when I first asked about this here ...
The expression in the script is (copied)
LET v_Trace = 'Gesamtzeit ist numerisch: ' & IF(ISNUM(Gesamtzeit_gerundet_syncreon)= (-1), 'ja', 'nein');
TRACE $(v_Trace);
LET v_Trace = 'Umsatz ist numerisch: ' & IF(ISNUM(Kosten_gerechnet_nach_gerundeten_Zeiten)= (-1), 'ja', 'nein');
TRACE $(v_Trace);
LET v_Trace = NULL();
The expression I use on the GUI is
ISNUM(Gesamtzeit_gerundet_syncreon)
and
ISNUM(Kosten_gerechnet_nach_gerundeten_Zeiten)
Best regards,
DataNibbler


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi tresesco,
sure that makes sense. So I will delete that code as it potentially leads to some confusion.
Thanks a lot!
