Alteryx Designer Desktop Discussions

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

Converting Scientific Notation to Number

Vermaipshita19
5 - Atom

Hi All,

 

I am having difficulties in converting large numbers into number format. 

 

My input is a text file, by default it takes all the feeds as V_WString and the number comes as a scientific number. Tried using multiple options-

1. Using fixed decimal- gives a null output

2. Using Double- converts keeps first few digits of the number and adds 0s in the end

3. ToNumber- converts keeps first few digits of the number and adds 0s in the end

 

Would anyone be able to help here?

 

Thanks,

IV

7 REPLIES 7
apathetichell
19 - Altair

Can you post a sample line? I want to get the spaces accurate... Basically I'd convert using REGEX replace... something along the lines of (\d+).*X.*10\^([-\d]+) and then something where you use tonumber($1)*pow(10,($2)) - but the exact format is specific to your data.

Vermaipshita19
5 - Atom

Hi, please find attached sample file.

apathetichell
19 - Altair

Those are in standard notation.  Are those being read in as scientific notation? I was having some issues reading in the .txt file but just cut and pasted it and then ran it through to number() had no problems like that.

apathetichell
19 - Altair

Does this work for you?

Vermaipshita19
5 - Atom

Thanks Aurora. This is still not working for me. 

Probably, if you can try this example.

atcodedog05
22 - Nova
22 - Nova

Hi @Vermaipshita19 

 

Here is how you can do it. This looks like a tsv file where columns are separated by tab.

 

1. Read the file in the below configuration

atcodedog05_0-1625324036820.png

2. Add a select tool after and convert amount datatype to double. It will automatically turn to number.

atcodedog05_1-1625324086788.png

 

Hope this helps 🙂

apathetichell
19 - Altair

Thanks - that's what I needed to see:

basically the formula I used to convert was:

tonumber(REGEX_Replace([Amount],"(-*).*","$1")+REGEX_Replace([amount],"-*(\d+\.\d+).*","$1"))* pow(10,tonumber(regex_replace([amount],".*\+(\d+)$","$1")))

 

with a fixed.with 35/6 - note. it worked for me as a straight double and but I wasn't sure how large some of your other values were. You can adjusted your fixed with for your max size as needed.

Polls
We’re dying to get your help in determining what the new profile picture frame should be this Halloween. Cast your vote and help us haunt the Community with the best spooky character.
Don’t ghost us—pick your favorite now!
Labels