IsInteger and leading Zeros
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello:
I have a hard time believing what I am seeing here.
I am using IsInteger to determine if a string is an integer (is a zip code).
What I found is that IsInteger gets confused by leading zeroes.
Attached is simple workflow.
Here are my results
Field1 Check
20220228 True
20200331 True
20270220 True
20161001 True
00112233 False
001234 False
010101 False
What am I missing here.
Best Regards
KD
Solved! Go to Solution.
- Labels:
- Workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@kevind0718 check this workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
add some text strings to the Text Input you then get
Field1 Check
20220228 True
20200331 True
20270220 True
20161001 True
00112233 True
001234 True
010101 True
ABC True
ALTERYX True
plus some warnings
The issue is: we have a string want to check if that string contains only digits (0 -9)
And there could be leading zeros
KD
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
hey @kevind0718 try this in your formula is worked jut now for me when I tested out my Code:
IF ISNULL([Field1]) THEN
0
ELSEIF REGEX_Match([Field1], "^[0-9]+$") THEN
1
ELSE
0
ENDIF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Does not answer the question: Is there an issue with IsInteger?
Maybe a bug
KD
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
And I found a regex work around.
Thanks for the suggestion.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@kevind0718
is this solved or still working on the issue?
if solved mark your solution done and close the question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Not resolved
The issue is: we have a string, want to check if that string contains only digits (0 -9)
And there could be leading zeros
IsInteger seems to fail when there are leading zeroes in the string.
Bug?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Not exactly a bug, leading zeros are useless, numerically speaking, so if that contains a leading zero it is not an integer, it is a string.
In the same way a ZIP code is not a integer per say, it is a string with numbers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@kevind0718 no its not a bug it is the way Alteryx interprets the values this stems from most programming languages as leading zero's can imply different number representation/formats such as octal or hexadecimal to name a few depending on the context hence why alteryx is most likely treating the leading zero's as text to avoid these types of issues and for simplicity purposes.
