Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

393
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda