Alteryx Designer Desktop Discussions

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

Find and replace with null fields remaining null (No data)

AlexL
7 - Meteor

Hello,

 

I am looking to find and replace specific data within a field to remove trailing commas/space from a concatenation.

 

The Find and Replace tool in Alteryx seems to require a 2nd field to replace the data I want it to find.

I want to replace the data fields with no data to still be null.

 

Original-

Record IDData Field/Column
1Refund, , , , 
2Refund, Credit, , , 
3Refund, Credit, Redeem, , 
4Refund, Credit, Redeem, Trade, 
5Refund, Credit, Redeem, Trade, Debit
6 

 

Find/ Replace-

FindReplace
, , , ,  
, , ,  
, ,  
 

 

Desired Outcome-

Record IDData Field/ColumnResult
1Refund, , , , Refund
2Purchase, Catalog, , , Purchase, Catalog
3refund, purchase, exchange, , refund, purchase, exchange
4Refund, Credit, redeem, trade, Refund, Credit, redeem, trade
5Refund, Credit ,redeem ,trade , debitRefund, Credit ,redeem ,trade , debit
6  
6 REPLIES 6
DanS
9 - Comet

Hey Alex, 

 

Try using the RegEx Tool like this:

 RegEx_Config.jpg

 

With this expression:

([\s\,]+$)

That should work for you. 

AlexL
7 - Meteor
Unfortunately, it is not working Please see image below -
DanS
9 - Comet

So sorry! Goofed at the end of the day!

 

RegEx_Rep.jpg

Replace the capture with just a blank replacement text. Sorry about that!

suli
9 - Comet

Hi,

 

You can try to use RegEx Replace, with expression (.*\w), replacement text $1 (do not copy unmatched text to output).

 

AlexL
7 - Meteor

Awesome thanks!

 

I was able to adjust the expression to clean other fields as well!

AlexL
7 - Meteor

This expression worked as well!  Thanks for the reply!!!

Labels