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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

concatenate context variable

Hi everyone,
I have a scenario where I can save SQL statement "SELECT * FROM" in contextA and "TABLENAME" in contextB.
The thing is I want to concatenate these two context variables in query parameter for database input component?
Is it possible?
Thanks in advance!
0683p000009MDQc.jpg
Labels (2)
7 Replies
Anonymous
Not applicable
Author

Hi
What's your SQL statement looks like without context vairable?
Shong
Anonymous
Not applicable
Author

Hi Shong,
It's just a simple SQL "SELECT * FROM EMPLOYEE" statement.
Regards,
Rozie
Anonymous
Not applicable
Author

Hi Shong,
It's just a simple SQL "SELECT * FROM EMPLOYEE" statement.
Regards,
Rozie

If the table name will be a variable, the query can be:
"select * from "+context.tableName
if the SQL has where condition, the query looks like:
"select * from "+context.tableName+" where id>10"
Hope this help you!
Shong
Anonymous
Not applicable
Author

Hi Rozie,
You can use tmap & in tmap join two columns using following function:-
row.column1+? ?+row.column2
Thanks
Anonymous
Not applicable
Author

Hi,
I have a SQL statement such that

select Q3.F0031 , Q4.F0171 , Q6.F1609,(Q3.F0031+Q3.F0032) as output
From STG_QSTN3 as Q3,STG_QSTN4 as Q4,STG_QSTN6 as Q6
where Q3.Estab_ID = Q4.Estab_ID
and Q3.Estab_ID = Q6.Estab_ID and Q4.Estab_ID = Q6.Estab_ID


Using the technique of context variable, I defined the SQL statement as "context.DOS_formula_Query".
Then in the excel file I separate the SQL statement into different sheet where the "select" statement I put in the sheet1 and "From...Where" statement I put in the sheet2.
Using the context variable, I called upon these statement using "context.DOS_formula_Query".
Is it possible to do above job? I found that the "From..Where" statement cannot be read. Is there any other alternative to do the job?
Below are the snapshot of the job.
Thanks in advance.
Regards,
naim
0683p000009MDQh.jpg 0683p000009MDMW.jpg 0683p000009MDEm.jpg 0683p000009MDQm.jpg
Anonymous
Not applicable
Author

Hi Naim
In the first and second images, there both has a same name called DOS_formula_Query. I think tContextLoad don't load the right value for the key DOS_formula_Query, because both sheets have a same key DOS_formula_Query. Can you check it?
Shong
janhess
Creator II
Creator II

I think you need different key names in the excel file and concatenate them in the database query.
keys DOS_formula_Select & DOS_formula_From
and in the query have context.DOS_formula_Select + " " + context.DOS_formula_From