0

I'm actually new to PDI and i need to do some extract from csv however sometimes field name are in lowercase or uppercase. I know how to modify it for rows but don't know how to do it for fields names.

Does exist a step to do it?
I tried ${fieldName}.lower(), lower(${fieldName}) in select value and javascript script but without succes

thanks in advance

2 Answers2

0

If you want to change a column name you can use the 'Select values' step.

There is a 'Rename to' option in the 'Select & Alter' tab as well as the 'Meta-data' tab that you can use to change a column name to whatever you want.

blairmeister
  • 915
  • 1
  • 6
  • 16
0

The quick fix is to right-click the list of column provided by the CSV file input to copy/paste it back and forth into Excel (or whatever).

If you also have 150 input files, the step which changes dynamically the column names (and other metadata like type) is called Metadata Injection, Kettle doc. The Official doc gives details and examples.

Your specific case is covered in BizCubed. Download the sample near the end of the web page, unzip, load the ktr in PDI. You'll need to adapt the Fields step in the MetaDataInjection transformation. It is currently a DataGrid that you may change by a Javascript lowercase (or better a String operation), after having kept the first line only of your CSV (read with header NOT present, include the rownumber and Filter rownumber=1).

AlainD
  • 6,187
  • 3
  • 17
  • 31