Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
anna_t1
Contributor III
Contributor III

How to get globalMap inside Java string to work with SQL component (tDBInput)

Hi all,

I managed to use a Manual query inside my TDBInput, like this:

  "SELECT

  DISTINCT col1

  '"+globalMap.get("start_dt")+"' as start_date

  FROM table1;"

The problem is when I try to the same but by reading it from a file with tFileInputRaw->TFlowToterate->TDBinput with

globalMap.get("row2.content") inside. The globalMap doesn't get solved at runtime because it's inside a Java string. I've tried to escape it, done lots of single and double quotes combinations, but can't seem to find a way of this to work. It's just the globalMap that it's not being translated, since the query runs smoothly in the database.

How can I workaround reading from SQL file, when my SQL text contains globalMap inside?

My SQL file is the same as the above SQL but without the leading double quotes. Still, doesn't work.

Labels (5)
3 Replies
hanghan
Contributor III
Contributor III

Could you please print the globalmap in the tjava, just before the database component?

madhukolli2003
Contributor III
Contributor III

Hi @Ana Tavares​ ,

 

 

Can you try removing single quotes from this  '"+globalMap.get("start_dt")+"' 

Also can you try adding valid datatype ((String)globalMap.get("start_dt"))

 

Thanks & Regards,

Madhu Kolli

 

Prakhar1
Creator III
Creator III

Can you try to use context instead of the global variable, and put the row2.content value in that context before proceeding to iteration ?