Search code examples
talendtalend-mdm

Talend Run If Trigger with context variables


I have a question regarding the output of a job.

Would it be possible to make an output of a job dynamic? What I mean is being able to configure a wanted output via a property or something? The user should be able to choose in what kind of database he wants the data to be imported by modifying a property.

Apparently, this can be done using a runIf - I unfortunately could not figure out how to do that.

The run if can only be used for booleans. For instance when a condition is met, the existence (or non-existence) of a file, if the number of rows returned is greater than 100, and countless other conditions.

How would it be possible the check if the context variable equals a specific String? For instance, if context.test = "postgres" then tpostgresqloutput, if context.test = "snowflake" then tsnowflakeoutput?

e.g.

job > tPostgresqlOutput > run if > context.test = "postgres"
job > tsnowflakeoutput > run if > context.test = "snowflake"

Thanks, BR


Solution

  • For String comparison in RunIf, you can use:

    context.test.equalsIgnoreCase("postgres")
    

    You may want to connect the appropriate dataflow to the above RunIf depending on whether it is postgres or snowflake.