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.

Extract number from text and replace null() in quantity field

hellyars
13 - Pulsar

Simple regex...

 

I want to isolate the number of school buses (in this example).  I can do it using \s(\d+\s), but how do I add it to Qty, when Qty exists and is null at the start?

 

 

 Qty
Mobile County Board of Education (Mobile) - $2.16 million to replace 76 school buses.put 76 here
3 REPLIES 3
atcodedog05
22 - Nova
22 - Nova

Hi @hellyars 

 

If you want to replace only when its null you can use a if block.

 

if isnull([Qty]) then Regex_replace([Field],"\s(\d)+\s","$1")

else [qty] endif

 

Is this what you are looking for ? or maybe i am missing the requirement.

 

Hope this helps : )

hellyars
13 - Pulsar

@atcodedog05   i tried something like that. The problem is qty is a double.  So, i tried wrapping it with a toNumber(), but that also does not seem to work.

 

atcodedog05
22 - Nova
22 - Nova

Hi @hellyars 

 

It seems to work for me. Can you try this.

 

Workflow:

atcodedog05_0-1628008956771.png

 

If this doesnt work for let me know the issue you are facing.

 

Hope this helps : )

 

Labels