I have data coming from a CSV feed.
Some field names have interspersed spaces.Normally you delimit them with backtick, ie `field name`, characters in SQL.In the Formula transformation you use [field name].However, neither syntax works in the Modified Javascript Values transformation, nor does field%20name, field_x0020_name etc
They reflect correctly in the Input Field list, as can be seen in the screenshot.
How can I reference such field names in the MJSV trnasformation?
If you have a field that contains a space, you can use that field in a "Modified Java Script Value" step by enclosing the field name in double quotes and square brackets. This will tell Pentaho to treat the entire field name as a single entity, rather than interpreting the space as a separator between separate field names.Alert(["Date Imported"]);
Thanks so much for responding Thomas.
However Alert(["Date Imported"]); only prints the literal string "Date Imported". It does not resolve the field by that name!
Try eval('Date Imported').
Thanks Petr, but that also does not resolve the field.
OK, this works:
//Script here var i = getInputRowMeta().indexOfValue("Date Imported") var value = row[i]
If step processes a lot of rows, so it's better define index of fields in start script (this is called only once before first row).
Ah Petr, you're a superstar... thanks so much.