Join the Alteryx Community’s Maveryx Summer Cup event! Compete, network with others, and earn your gold through a series of challenges from July 24th to August 11th. Learn more about the event here.

Alteryx Designer Desktop Discussions

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

Read csv file with header on the second line but keeping the data of first line

RVDL
7 - Meteor

Hi All,

 

Suppose I have a csv file as per attachment. It contains the following data:

 

"Account Overview","20221108",,
"Account Date","Country","City","Amount"
"20220930","UK","London","100.25"
"20220930","UK","Birmingham","16.5"
"20220930","France","Paris","50.125"
"20220930","Germany","Frankfurt","123.45"
"20220930","France","Nice","5432.987"
"Total Accounts","5",,

 

The header starts on line 2. I now need a workflow that does the following:
- Read the csv file.
- For those lines where "Country" = UK, multiply "Amount" by 2.

- Output a csv file as per below:
"Account Overview","20221108",,
"Account Date","Country","City","Amount"
"20220930","UK","London","200.5"
"20220930","UK","Birmingham","33.0"
"20220930","France","Paris","50.125"
"20220930","Germany","Frankfurt","123.45"
"20220930","France","Nice","5432.987"

Thus the output file should include the first line ("Account Overview","20221108",,), and should drop the last line.

 

Thanks.

12 REPLIES 12
DataNath
17 - Castor

@RVDL here's what I came up with and as you can see, it's independent of column positions:

 

DataNath_0-1668851072136.png

 

DataNath_1-1668851106385.pngDataNath_2-1668851345156.png

Felipe_Ribeir0
16 - Nebula

Hi @RVDL 

 

You are right, i missed it. Here it is, now with this new correction:

 

Felipe_Ribeir0_0-1668859681974.png

 

RVDL
7 - Meteor

@Felipe_Ribeir0 @DataNath Thanks both. Your solutions give the desired result.

Labels