Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

395
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda