Alteryx Designer Desktop Discussions

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

Remove line breaks in text file

45179902
8 - Asteroid

I have a text file with records broken down into two lines. I want to put them back in one line. Below is an example

 

=== Sample Start ===

 

First Name

Last Name

Heath
Packer

Samantha

Hugh

 

First Name

Last Name

Gary

Evans

Shawn

Owen

 

=== Sample End ===

 

Expected output:

 

First Name     Last Name

Heath             Packer

Samantha      Hugh

Gary               Evans

Shawn            Owen

 

In tabular format. Note that the headers are also broken down into two lines and need to be put back together. This example includes two tables separated with a line break. When we put together, I want to keep only the first headers and remove the other.

3 REPLIES 3
ed_hayter
12 - Quasar

If you are confident the structure will be consistent this should work

 

Paired Text.png

 

We use an alternating 0 then 1 0 then 1 field to determine first or last name i call pairId, then i use the pair id in a multirow to make a recordID where every time pairID = 0 increase the recordID so we have a field that looks like 1,1,2,2,3,3 etc. Then Pivot with pairID being the headers grouped by recordID filter rename the columns and filter out duplicate headers in the data.

flying008
14 - Magnetar

Hi, @45179902 

 

FYI.

录制_2023_08_11_15_55_49_193.gif

PhilipMannering
16 - Nebula
16 - Nebula

This is def overkill, but here is a third way of doing it.

image.png

 

Nice use of the Make Columns Tool @flying008 !

 

 

Labels