Alteryx Designer Desktop Discussions

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

Trying to identify the dollar amount in a line of text

scott_fuller
6 - Meteoroid

Hi - I am working to try and gather a dollar amount figure from a text string within a workflow.  I have included a sample of 5 rows of text to illustrate the format of text string (see below).  TRANSFER is always present, and the "(" indicates a negative number. 

 

Alteryx example.jpg

 

What I am trying to achieve is having a new column with just the dollar amounts (see Output column below).

 

image.png

 

Any suggestions on modules and instructions would be greatly appreciated.

7 REPLIES 7
binuacs
20 - Arcturus

@scott_fuller One way of doing this

image.png

scott_fuller
6 - Meteoroid

Wow - thanks for such a quick reply.  Does the logic work regardless of length of the dollar amount?  I ask because the amount can be as little as a few million dollars to multiple billions of dollars. 

 

When trying the solution above the new column of data was all [null].  I don't really understand what the expression is actually doing, so hard to edit to make it work.  

Qiu
20 - Arcturus
20 - Arcturus

@scott_fuller 
I noticed that there is also decimal point and also space between "(" and "$", so maybe we can try as this based on flow @binuacs 

0510-scott_fuller.png

scott_fuller
6 - Meteoroid

Thanks - So there is not always a "(" in the field.  Perhaps there is a way to gather the data between key words. 

 

The first word in each field is "TRANSFER" and then the bit of information I am after followed by the word "FROM".  Is there a way to extract anything between those 2 words as a separate column?

 

Field example: 

TRANSFER ( $567,098,519.03) FROM A to B      

TRANSFER   $567,098.03 FROM F to G

TRANSFER ( $23,567,098,519.03) FROM A to Y

TRANSFER     $567,098,519.03 FROM 5 to 8

 

Adds a new column with:

( $567,098,519.03)

$567,098.03

( $23,567,098,519.03)

$567,098,519.03

Qiu
20 - Arcturus
20 - Arcturus

@scott_fuller 
Thank you for the additional information.
I just tried with my flow, it seems to work as it is

Keywork I am using is the sign "$" and end of digit.

0510-scott_fuller-A.png

scott_fuller
6 - Meteoroid

This works great - thank you so much!!

 

In the spirit of "teaching a man to fish" can you explain what the individual pieces of the regex expression do?  Or is that asking too much?

Qiu
20 - Arcturus
20 - Arcturus

@scott_fuller 
Of course not, thank you for asking actually.

I am always using this website for RegEx, and it gives good explaination how the RegEx works.

https://regex101.com/
As you can see the righthand side of the sanpshot below.

0510-scott_fuller-B.png

 

Labels