Important Community update: The process for changing your account details was updated on June 25th. Learn how this impacts your Community experience and the actions we suggest you take to secure your account here.

Alteryx Designer Desktop Discussions

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

Add a Starting Record to a file

ewassell
8 - Asteroid

I have a file that contains all the info below - the header files need to be first and then the rows with the data come after but the first line needs to be LEDES1998B by itself.  Any idea how to do this?  I have it all except how do I get this first line that just says LEDES1998B?

 

LEDES1998B

INVOICE_DATE|INVOICE_NUMBER|CLIENT_ID|LAW_FIRM_MATTER_ID|INVOICE_TOTA
L|BILLING_START_DATE|BILLING_END_DATE|INVOICE_DESCRIPTION|LINE_ITEM_NUMBER|EXP/FE
E/INV_ADJ_TYPE|LINE_ITEM_NUMBER_OF_UNITS|LINE_ITEM_ADJUSTMENT_AMOUNT|LINE_ITEM_TO
TAL|LINE_ITEM_DATE|LINE_ITEM_TASK_CODE|LINE_ITEM_EXPENSE_CODE|LINE_ITEM_ACTIVITY_
CODE|TIMEKEEPER_ID|LINE_ITEM_DESCRIPTION|LAW_FIRM_ID|LINE_ITEM_UNIT_COST|TIMEKEEP
ER_NAME|TIMEKEEPER_CLASSIFICATION|CLIENT_MATTER_ID

19990225|96542|00711|0528|1684.45|19990101|19990131|For services rendered|1|F|2.00|-70|630|19990115|L510||A102|22547|Research Attorney’s fees, Set off claim|24-6437381|350|Arnsley, Robert|PT|423-987

19990225|96542|00711|0528|1684.45|19990101|19990131|For services rendered|2|F|2.00|0|700|19990115|L510||A102|22547|Research attorney's fees, Trial pleading|24-6437381|350|Arnsley, Robert|PT|423-987

6 REPLIES 6
caltang
17 - Castor
17 - Castor

Something like this?

caltang_0-1681178128230.png

 

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
caltang
17 - Castor
17 - Castor

If your data comes together, then you can use a filter tool instead to filter out LEDES1998B, and use a record ID as shown above.

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
ArnaldoSandoval
12 - Quasar

Hi @ewassell 

 

There was several ways to go about your issue, mine is based on your data from a single file, I read the file twice with different configurations, check them, the first time it just peek the first row the second time the just the remaining records with header.

 

2023_04_11_Add_Starting_Record-01.png

This is the output:

2023_04_11_Add_Starting_Record-02.png

WARNING:

My solution, and the other one posted only work for the sample data you shared, it will fail if more invoices and leading files are received.

 

hth

Arnaldo

RobertOdera
13 - Pulsar

Hi, @ewassell 

 

Kindly consider the below.

I hope you find it helpful - Cheers!

 

RobertOdera_0-1681181640559.png

 

ewassell
8 - Asteroid

Thank You! This is almost it but if I save the outgoing file as a .csv file with a delimiter of |, it shows the pipes after the LEDES1998B in the same line. How do I get rid of them?

ArnaldoSandoval
12 - Quasar

Hi @ewassell 

 

One way to strip those |s from the output CSV files is by splitting the stream, the first record with LEDES1998B is written by itself to the output csv, the remaining records are appended to the output csv. but because Ateryx CSV output does not support appending, so we need a macro to achieve the appending, 

 

I found the AppendtoCSV here in the Alteryx's Community (I lost its link), I modified it to output pipe | separator.

 

While testing I found that your fields LINE_ITEM_DESCRIPTION and TIMEKEEPER_NAME contains commas, so I replaced their commas with spaces NOTE: I am using the latest version of Alteryx, one of the workflows posted here do not need the comma replacement, who knows why?

 

Hope this helps,

Arnaldo

Labels