Free Trial

Alteryx Designer Desktop Discussions

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

Add equal Delimiters

BRRLL99
11 - Bolide

Hi
I have following data set, I would like to Add |0 After the text, whenever there is only 3 delimiters
For ex: from SLno: 2 to 5 , as show below I have 4 delimiters , which can be separated into 4 columns but 
from slno" 7, I have only 3 delimiters , whenever there is 3 delimiters i would like to add |0

ex: slno: TOTAL ACQR|0|185|590.00|199,67CR

 

SLNODATA
1INTR VALUE
2TOTAL ACQR|134|145|55.00|134,67CR
3TOTAL ISS|0|0.00|0.00|0
4TOTAL OTHER|0.00|0|0.00|0
5TOTAL INTR VALUE|134|145|55.00|134,67CR
6FEES
7TOTAL ACQR|185|590.00|199,67CR
8TOTAL ISS|0.00|0.00|0
9TOTAL OTHER|0|0.00|0
10TOTAL FEES|185|590.00|199,67CR
11INTR VALUE
12TOTAL ACQR|177|55.00|134,67DB
13TOTAL ISS|0.00|0.00|0
14TOTAL OTHER|0.00|0|0.00
15TOTAL INTR VALUE|177|55.00|134,67DB
16FEES
17TOTAL ACQR|185|590.00|199,67CR
18TOTAL ISS|0.00|0.00|0
19TOTAL OTHER|0|0.00|0
20TOTAL FEES|185|590.00|199,67CR

 

Expected output : (from 6 to 10 shown as example)

FEES    
TOTAL ACQR0185590199,67CR
TOTAL ISS0000
TOTAL OTHER0000
TOTAL FEES0185590199,67CR
3 REPLIES 3
binuacs
21 - Polaris

@BRRLL99 

one way of doing this

image.png

BRRLL99
11 - Bolide

Thank you 

in my real data set I have additional rows also
if I use the given regex, it giving COUNT|0|CREDIT|DEBIT|TOTAL, where there is Count

 

DATA
COUNT|CREDIT|DEBIT|TOTAL
AMOUNT|AMOUNT|AMOUNT
COUNT|CREDIT|DEBIT|TOTAL
AMOUNT|AMOUNT|AMOUNT
INTR VALUE
TOTAL ACQR|134|145|55.00|134,67CR
TOTAL ISS|0|0.00|0.00|0
TOTAL OTHER|0.00|0|0.00|0
TOTAL INTR VALUE|134|145|55.00|134,67CR
FEES
TOTAL ACQR|185|590.00|199,67CR
TOTAL ISS|0.00|0.00|0
TOTAL OTHER|0|0.00|0
TOTAL FEES|185|590.00|199,67CR
COUNT|CREDIT|DEBIT|TOTAL
AMOUNT|AMOUNT|AMOUNT
INTR VALUE
TOTAL ACQR|177|55.00|134,67DB
TOTAL ISS|0.00|0.00|0
TOTAL OTHER|0.00|0|0.00
TOTAL INTR VALUE|177|55.00|134,67DB
FEES
TOTAL ACQR|185|590.00|199,67CR
TOTAL ISS|0.00|0.00|0
TOTAL OTHER|0|0.00|0
TOTAL FEES|185|590.00|199,67CR
binuacs
21 - Polaris

@BRRLL99 The above regex works based on the count of the delimiter '|', because the count row has 3 delimiters it adds the |0 to the count row as well

 

try

IIF(REGEX_CountMatches([DATA], '\|') = 3 AND REGEX_CountMatches([DATA], '\d') !=0,REGEX_Replace([DATA], "(.*?)\|.*", '$1')+'|0|'+REGEX_Replace([DATA], "(.*?)\|(.*)", '$2'),[DATA])
 

 

 

Labels
Top Solution Authors