Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a job in which I assign a value to two context variable of integer type. I am using tDBInput to retrieve the value from database and tJavaRow to assign it to my context variable . My job is something like this:
tDBInput --> tJavaRow1-->tDBInput --> tJavaRow2-->tFileList--->tFileInputPositional-->tMap-->tDBOutput.
in tJavaRow1: context.myVar1=input_row.value;
in tJavaRow2: context.myVa2r=input_row.value;
In tJavaRow I put a System.out.println(context.myVar1) to verify the value retrieved and it exist.
The problem is that in tMap I assign context.myVar1 to myColumn, but the result is null. I do not understand the reason. My TMap:
Does anyone could help me?
Thank you in advance!
This is a timing issue. You need to use a tFlowToIterate in place (or after) your tJavaRow1 and iterate over the next tDBInput calls. For every row the first tDBInput returns, you can guarantee that the rest of the flow will run and finish before the next row is processed. If you are simply assigning a context variable in the first tJavaRow, just replace it with the tFlowToIterate. This will store the whole row as globalMap values. You can use the globalMap value in your tMap at the end
This is a timing issue. You need to use a tFlowToIterate in place (or after) your tJavaRow1 and iterate over the next tDBInput calls. For every row the first tDBInput returns, you can guarantee that the rest of the flow will run and finish before the next row is processed. If you are simply assigning a context variable in the first tJavaRow, just replace it with the tFlowToIterate. This will store the whole row as globalMap values. You can use the globalMap value in your tMap at the end
I tried this technique and it is working for the first tFlowTolterate, but not for the 2nd one. I attached my job below:
I got an exception in tMap:
Exception in component tMap_1 (mainImpA_Prodotto_Fasce)
java.lang.NullPointerException
Moreover, the value I retrieve from ATTR_PROG_ELAB is of type of String. I need to convert it in integer type. I actually put in tMap ((int)globalMap.get("attr_prog_elab")).
How can I solve this?
I solved it! I was doing integer cast in my ATTR_PROG_ELAB. I retrieved the value I needed a String (without casting) and then in tMap I put ((int)globalMap.get("attr_prog_elab")).
Glad you solved it your second issue. Sorry, I wasn't at my machine earlier. You have to be really careful with casting correctly when using the globalMap. Would you mind also accepting my solution to this (you can accept more than one solution) since it was the solution to the initial problem 🙂