Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Question on data import from Excel

jeffv
8 - Asteroid

Hi,

 

Just wondering if someone might give me some ideas...  I am importing from excel some data.  One field did not have format set correctly in excel file.  It's a version field.  While Alteryx imports it into a text field  sometimes it has numbers such as "4.1" and some times "vx8.3" along with other data.  If the field truly has alpha numeric data then it needs to stay as text... however something like 4.1 due to translation from excel changes to 4.099999 or some lengthy floating point.

 

So I need to import the data in and if it is a floating point use the function ToNumber(ToString([Version],1)) to convert it to a text string of "4.1"  (or something similar).

 

I've looked through the forum (I'm on 10.5) and am trying to do something like...

 

if IsInteger([Version]) then ToString(ToNumber([Version]),1)
else [Version]
endif

 

This does not change the value... it keeps is at 4.09999

 

It appears that any data that has 4.09999 or 1.10001 is treated as a string.  I tried using IsNumeric and it came back false.  Just wondering if there is an easy way to check if a text field can be checked for a floating point number?  Then if it is a float then convert to a number with 1 decimal place else just use the original text value.

 

What was originally simple has turned out to be a bit complicated.

 

Thanks for any insight.  I searched but didn't find any direct solutions in the forums.

 

Thanks,

Jeff

 

1 REPLY 1
jeffv
8 - Asteroid

Ended up using following if statement:

 

if ToNumber(Trim([Version]))!=0 then ToNumber([Version])
else [Version]
endif

Labels