Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] ((Integer)globalMap.get("tMSSqlOutput_2_NB_LINE_INSERTED"))

After an insert in a table in a SQLServer Database, I want to display the number of records inserted
So I use the global variable ((Integer)globalMap.get("tMSSqlOutput_2_NB_LINE_INSERTED"))
and I get Null as result.
I have check in the table the row is inserted!
Where is my misstake?
Thanks
Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi
The variable have to be used in the next subjob rather than child job, so change the job as seen below, you should be able to get the value of the global variable.
For example:
tFileFetch
   |
onsubjobok
   |
your main processing---tMssqlOutput_1
  |
onsubjobok
   |
tFixedFlowInput--main--tLogRow
on tFixedFlowInput, you get the number of lines which has been updated/inserted/deleted on tMssqlOutput, to do it: define one column called it nb_inserted, and set its values as:
((Integer)globalMap.get("tMSSqlOutput_1_NB_LINE_INSERTED"))
Regards
Shong

View solution in original post

8 Replies
Anonymous
Not applicable
Author

Hi 
Can you please upload a screenshot of job? I think there might be a job design issue here.
Best regards
Shong
Anonymous
Not applicable
Author

Below the screenshot of the job:

0683p000009MA18.png

((Integer)globalMap.get("tMSSqlOutput_1_NB_LINE_UPDATED"))  are in the tMap_3 et tMap_4 components
Anonymous
Not applicable
Author

No idea????? 0683p000009MPcz.png
Anonymous
Not applicable
Author

Hi 
It is not a bug, this kind of global variable should be used in next subjob, if you look into the generated code of job, you will see the the code  ((Integer)globalMap.get("tMSSqlOutput_1_NB_LINE_UPDATED")) on tMap_3 is executed before putting value to the global variable in the end part of tMssqlOutput, so you need to change the job design, eg:
....tMSSQLOutput--tHashOutput
   |
onsubjobok
   |
tHashInput--main--tMap_3....

Best regards
Shong
Anonymous
Not applicable
Author

now I have the following main job:

0683p000009MBgv.png

and 2 subjobs :

0683p000009MC3Y.png

0683p000009MC3Y.png

but I don't see the number of rows inserted or updated!!

Another ideas??

Thanks
Anonymous
Not applicable
Author

Now I have the fillowing job:

0683p000009MC3d.pngthe subjob:


0683p000009MBnb.png
But I have many error in the subjob:

0683p000009MC3i.png
Any ideas??
Thanks
Didier
Anonymous
Not applicable
Author

Hi
The variable have to be used in the next subjob rather than child job, so change the job as seen below, you should be able to get the value of the global variable.
For example:
tFileFetch
   |
onsubjobok
   |
your main processing---tMssqlOutput_1
  |
onsubjobok
   |
tFixedFlowInput--main--tLogRow
on tFixedFlowInput, you get the number of lines which has been updated/inserted/deleted on tMssqlOutput, to do it: define one column called it nb_inserted, and set its values as:
((Integer)globalMap.get("tMSSqlOutput_1_NB_LINE_INSERTED"))
Regards
Shong
Anonymous
Not applicable
Author

Thanks Shong
easier and it works!

0683p000009MC3n.png