I need to passing variable from modified java script value and pass it to table input query
If i click preview the output
initator_reference | a | '' |
1 | a | null |
2 | a | null |
3 | a | null |
4 | a | null |
It shouldnt be null but "testing" string on that third field and dont ask me why i put that variable in select, its just for testing before i put it in "where condition=variable"
Table Input supports two different ways of making the SQL dynamic: Variable Substitution and inserting data from an incoming stream.
Variable substitution
This is what you currently have configured in the Table Input: You put ${variable} somewhere and when the step initializes, the value is pasted as text into the SQL.
Because all the steps initialize at the same time in a transformation, your Javascript step has not had time to set the value. In PDI you cannot set and use a variable within the same transformation.
Insert data from step
The second way is used by selecting a source step in the "Insert data from step" option in the Table input. In this mode, the Table Input takes a row from the selected step and inserts fields (in order) into the SQL at question marks (?) you insert. Normally it expects a single row, but you can choose to execute for EACH row.
This way should work for your scenario:
Notes: