Search code examples
expressionetltalendflat-file

Talend Open Data Integration: Read expressions from excel file and then execute them in tMap


I'm quite new to Talend and would like to read an expression from a given file and then execute it in tMap function.

The expressions are stored in a separate excel column like this:

row7.value1 + row7.value2 == 0 ? 0 : row7.value1/(row7.value1 + row7.value2)

I accomplished to read it as a string by global map:

((String) globalMap.get("row6.column_that_contains_expr")).

But I'm not able to execute the expression in tMap in order to get the resulting value.

My job looks like this:

tFileInputExcel =row6=> tFlowToIerate => tPostgresqlInput =row7=> tMap => tFileOutpuDelimited

Could you please tell me how to execute the expression from file and obtain the resulting double?

Greetings

Simon


Solution

  • What I would usually do is to have before the tFlowToIerate a tJavaRow Component where I would assign the values into context variables and use them in the tPostgresqlInput directly from the context