Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
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
Valued Contributor II

Re: Use variable with set analysis in Where condition of SQL

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

MVP
MVP

Re: Use variable with set analysis in Where condition of SQL

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.

Community Browser