Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
is there a way to change Talend's component properties (ex activate/deactivate component) from java code - not using right click?
Let say I would like to have a job (job_main) with code in tJava like:
IF globalmap.get("var1") == 1 THEN JOB(name).COMPONENT(name).activate IF globalmap.get("var2") == 0 THEN JOB(name2).COMPONENT(name2).deactivate;
So after that I can run other mentioned jobs with particular components activated/deactivated.
Is it possible? I know that running job generate some java code that can't be changed during execution, that why I accept situation when I have to run "job_main" first and then other (modified) jobs after that manually.
I am new to Talend, but familiar with VBA, so for me its like changing properties of some object from VBA code (like change color of shape in the sheet)
After all I am asking that question because I have a job like: input --> tMap --> multiple outputs and I would like to execute only particular outputs according to some variable values. (there are ~10 outputs and I have 30 jobs like that - will be more that 100) I was looking into RUN IF but unfortunately I cant use run if beetwen tMap and Output.
Can any one help me with my issue?
There is no way to activate/deactivate a Component by Java code.
But you can control Creation of Output from tmap using Global Var/Context in ExpressionFilter
There is no way to activate/deactivate a Component by Java code.
But you can control Creation of Output from tmap using Global Var/Context in ExpressionFilter
Hi,
you can not activate/deactivate components
but you could use RunIf trigger for this
It sounds like you can do this without activating/deactivating code. In your example you talk about a tMap with 10 outputs. You can filter the outputs dynamically quite easily.
For example.....
I might have a job with 3 possible flows out of a tMap; flowA, flowB and flowC.
I can parameterise these so that the flow can be changed based upon a simple context variable that is supplied to the job at runtime.
Below is a screen shot of a basic job like this...
Inside the tMap, it looks like this....
If you look at the 3 output flows, they are each filtered by a context variable called Flow. This can be set at runtime.
So that is one way of achieving what you described, there are also several other ways. You will need to be a bit more specific about your requirement for us to nail down the path you need to take.
I keep doing this, I pick a post to answer and then get sidetracked with something else. Come back to it. Post. Then find out that I have essentially answered in the same way as others. Sorry @uganesh, our answers are practically the same. @vapukov that was potentially going to be one of the alternatives I would have offered if what I (and @uganesh ) offered was not what was required.
@uganesh , @rhall Thanks guys, that filter is exactly what I needed!
I have one problem with that solution, probably because I don't understand global variables.
I am using global variable in filter [((Integer)globalMap.get("var1")).equals(1)] and everything works when I set global variables inside job like on the screen below:
But like I said before there will be more than 100 jobs of that kind. So I would like to set global variables once, in the begging of main job and then check variables values in sub jobs (called by tRunJob from main job). When I set global variables in main job (pic below) and call child job (on pic above without tJavaRow part) I get error during tMap "java.lang.NullPointerException".
I guess its because global variable that I have in condition is not set (null) and I get nothing to output.
Can I pass global variables values to every sub job and avoid setting their values inside every sub job?