isaapm
isaapm

Reputation: 157

Pentaho DI (Kettle) best way to select flow based on csv file header?

I'm using Pentaho DI (kettle) and not sure what's the best way to do the following: From a downloaded csv file, check if a column exists, and based on that select the right next step. There are 3 possible options.

Thanks, Isaac

Upvotes: 0

Views: 716

Answers (1)

Kamil Gosciminski
Kamil Gosciminski

Reputation: 17147

You did not mention possible options, so I'll just provide you with a sketch showing how to check if a column exists in a file.

For this you will need a CSV file input step and Metadata structure of stream step which will read the metadata of the incoming stream.

Transformation

For a sample csv file with 3 columns named col1, col2 and col3 you get every column in a separate row with its name as a value in Fieldname column in Metadata step.

Metadata results

Then depending on your needs you could use for example Filter Rows or Switch / Case step for further processing.

Upvotes: 2

Related Questions