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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Use variable with set analysis in Where condition of SQL

Hi qlik gurus,

We have a fiscal calendar and a QVD based on that,

I have a sql query in my qlikview load script in which I want to pass current fiscal period (which is a column in the qvd) in where condition like so- WHERE fiscal_period = '$(vPeriod)'

and my variable is Let vPeriod = chr(39)&Only({<DATE={"=today()"}>}Period_Name)&chr(39)

When i load the script and print the variable in Text box I get the resolved value but when i clikc on load script, this perticular query doesnt fetch any rows.

I am not sure why, please help me.

2 Replies
danieloberbilli
Specialist II
Specialist II

could be a date format issue. Try to use the number format of the date using num()

jagan
Partner - Champion III
Partner - Champion III

Hi,

Only() don't work in script, try Peek() or LookUp().  First check whether you are getting value in variable?

Is your fiscal_period column, Period_Name and vPeriod variable are in the same format?  If not convert vPeriod to fiscal_period format.


If not working can you attach some sample values of fiscal_period

Hope this helps you.

Regards,

Jagan.