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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
_AnonymousUser
Specialist III
Specialist III

[resolved] SELECT query from tPostgresqlInput and storing reult in variable?

Hi.
My job is roughly this:
tFileList --(iterate)-> tFileInputDelimited --(row1)-> tMap --(out1)-> tPostgresqlOutput
  |
  |
(iterate2)
  |
  v
tPostgresqlInput (for calling SELECT function() to further process data in db)

ie. I load data from files (iterating) to a DB and after each
iteration, I call a function in tPostgresqlInput to further
process the data in the DB. The function returns a value
that I would like to write to a variable and later write to a
log file of as sort. But how do I write the value to a
variable?
Later in process the file writing part would connect to
the tFileList above with another iterate arrow ( iterate3)
to log the file name loaded and the value returned from
the function, pretty much like this:
   ...
|
(iterate3)
|
v
tFileProperties-(row3)->tMap -(out3)-> tFileOutputDelimited

So basically my question is: how to write a single value
selected from tPostgresqlInput to a variable?
JB
Labels (2)
1 Solution

Accepted Solutions
_AnonymousUser
Specialist III
Specialist III
Author

OK, I solved this with tSetGlobalVar component like this:
tFileList --(iterate)-> tFileInputDelimited --(row1)-> tMap --(out1)-> tPostgresqlOutput
 |   |
 |   |
 | (iterate2)
 |   |
 |   v
 |  tPostgresqlInput --(row2)-> tSetGlobalVar
 |
 |
(iterate3)
 |
 v
tFileproperties --(row3)-> tMap --(out2)-> tFileOutputDelimited

Then in components:

tPostgresqlInput: add field in schema for the value (code)
tSetGlobalVar: "code" as key, row3.code for value
tMap: ((String)globalMap.get("code")) in out2

Please feel free to share better solutions.
JB

View solution in original post

2 Replies
Anonymous
Not applicable

Hi,
You can use tJavaRow  to save each value to a variable for re-use in the next Input component.

Best regards
Sabrina
_AnonymousUser
Specialist III
Specialist III
Author

OK, I solved this with tSetGlobalVar component like this:
tFileList --(iterate)-> tFileInputDelimited --(row1)-> tMap --(out1)-> tPostgresqlOutput
 |   |
 |   |
 | (iterate2)
 |   |
 |   v
 |  tPostgresqlInput --(row2)-> tSetGlobalVar
 |
 |
(iterate3)
 |
 v
tFileproperties --(row3)-> tMap --(out2)-> tFileOutputDelimited

Then in components:

tPostgresqlInput: add field in schema for the value (code)
tSetGlobalVar: "code" as key, row3.code for value
tMap: ((String)globalMap.get("code")) in out2

Please feel free to share better solutions.
JB