0

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

isaapm
  • 157
  • 2
  • 12

1 Answers1

2

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.

Kamil Gosciminski
  • 16,547
  • 8
  • 49
  • 72