Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Designer Desktop Discussions

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

Add trailer record without extra pipes at the end

Val2018
6 - Meteoroid

I need to produce a pipe delimited output with the trailer record containing the number of records without the header.  However, the trailer record should not have pipes after the number or records.  I need help with figuring out how to do it since my results ended up having as many pipes as the fields in the data.  The current WF and the resulting output are attached.

8 REPLIES 8
Garabujo7
Alteryx
Alteryx

Hello @Val2018 ,

 

I looked at your results and are correct. The extra pipes on the end mean empty spaces in the extra columns

 

Garabujo7_0-1633108355440.png

 

You have two additional pipes at the end. Both mean the 2 extra columns with no values.

It is easier to see it in the data. The address and issue are null for the number of records

 
 

2021-10-01_12-12-54.jpg

 

Gabriel

 

Val2018
6 - Meteoroid

@Garabujo7

 

Is there a way to remove the pipes but otherwise to keep the output intact?

 

Thanks,

 

Valentina

danilang
19 - Altair
19 - Altair

Hi @Val2018 

 

To remove the extra pipes, you can use 

TrimRight([Field1],"|")

Note that if the target program is expecting a properly formed .csv file, you may get errors on input to the external program if the extra pipe characters are missing.

 

Dan  

Val2018
6 - Meteoroid

Hi @danilang,

Could you please clarify where in the workflow I need to insert the Trim formula?  As long as this specific record modification does not affect the rest of the data and allow it to be outputted in the right format, all is good. 

 

Thanks,

 

Valentina

danilang
19 - Altair
19 - Altair

Hi @Val2018 

 

Since you're using the Output Tool to create the csv file, the delimiters are put in automatically with no way to remove them if they are the final characters in the field.  To get around this build the strings manually, trimming the trailing pipes as required, add a header row  and write them out to a csv file with no delimiter(\0)

 

danilang_0-1633358543106.png

 

Dan

Val2018
6 - Meteoroid

Hi @danilang,

 

Thank you for a creative solution!  It will work as long as there are not too many fields.

 

Valentina

danilang
19 - Altair
19 - Altair

Hi @Val2018 

 

Here's the dynamic version.  It will work with any number of columns with no changes.

 

danilang_0-1633689846273.png

 

It transposes all values and then builds the value and header rows.  

 

Dan

 

 

Val2018
6 - Meteoroid

Hi @danilang,

 

Thank you so much for your help!

 

Valentina

Labels
Top Solution Authors