Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

400
Views
skip transformation not working in Pentaho modified javascript

Below is my modified javascript for a basic pentaho transformation job. From a 2 row ( excluding header row) csv file input an xml output file is being generated. If I remove the 1st and last line of code, it works without error though it process all row.

Question 1: How can I correctly skip the 2nd row from csv file.

Question 2: What is the correct way to get input field datatype like number/string etc. ? getValueMeta function is giving many additional things which I don't need.

My csv file is as below:

enter image description here

My transformation is as below: enter image description here

//Script here
trans_Status = CONTINUE_TRANSFORMATION;
var column_name = "SSTI_pre-trade";
var column_index = getInputRowMeta().indexOfValue(column_name);
var column_value = row[column_index];
var column_type=getInputRowMeta().getValueMeta(column_index)
writeToLog("b", column_type);
var converted_number=getInputRowMeta().getNumber(row,column_index);
var skip_number=getInputRowMeta().getNumber(row,6);
writeToLog("b", skip_number);
var msg = 'Hello, ' + num2str(converted_number) + "!";
if (skip_number = 2) {trans_Status = SKIP_TRANSFORMATION;}

Below is log when skip transformation not working but it shows that skip_number variable value is correct.

2022/03/16 18:46:22 - HelloWorld - Dispatching started for transformation [HelloWorld]
2022/03/16 18:46:22 - XML output.0 - Opening output stream in encoding: UTF-8
2022/03/16 18:46:22 - CSV file input.0 - Header row skipped in file 'file:///D:/Pentaho_projects/Hello_world/sample2.csv'
2022/03/16 18:46:22 - CSV file input.0 - Finished processing (I=3, O=0, R=0, W=2, U=0, E=0)
2022/03/16 18:46:22 - Modified JavaScript value.0 - Optimization level set to 9.
2022/03/16 18:46:22 - Modified JavaScript value.0 - SSTI_pre-trade Integer(15)<binary-string>
2022/03/16 18:46:22 - Modified JavaScript value.0 - 1.0
2022/03/16 18:46:22 - Modified JavaScript value.0 - SSTI_pre-trade Integer(15)<binary-string>
2022/03/16 18:46:22 - Modified JavaScript value.0 - 2.0
2022/03/16 18:46:22 - Modified JavaScript value.0 - Finished processing (I=0, O=0, R=2, W=0, U=0, E=0)
2022/03/16 18:46:22 - Spoon - The transformation has finished!!
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I don't know about your second question, but for the first question, if you have a fixed condition of the rows to skip from the csv, i.e., as you have stated, you want to skip the second row, the easiest way would be to read the csv and add a column when you are configuring the step with the rownumber, and afterwards add a filter rows step with the condition rownumber <> 2: Example to skip fixed rows

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!