Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date variable

Hi

I have the following in my script:

select top 2000

CASE

cb.FinancialPeriod,

c

cb.Actual

from plc

where financialperiod between ($(v_userStart)) and ($(v_userEnd));

I have then setup the two variables in in the document properties with some dates set in both.   However, when I reload the app no data appears.  Can you please help? What am I missing? 

6 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Not sure whar DBMS you are using, but it probably needs quotes on the dates, like this:


financialperiod between '$(v_userStart)' and '$(v_userEnd))'

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
jonathandienst
Partner - Champion III
Partner - Champion III

If that is not it, perhaps the variables are nor returning what you expect. If you switch to debug mode and put breakpoint before the Select, them you can step to that point and see exactly what query is being sent to the DBMS.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

its a SQL db

jagan
Luminary Alumni
Luminary Alumni

Hi,

Check the variables whether they are getting values in it, may be that is the issue.  Also date values need to be surrounded by single quotes.

select top 2000

CASE

cb.FinancialPeriod,

c

cb.Actual

from plc

where financialperiod between '$(v_userStart)' and '$(v_userEnd);

Also check the date formats are same in both variables and your date field.

Regards,

Jagan.

Not applicable
Author

it looks like i had missing quotes.  Thanks all

jagan
Luminary Alumni
Luminary Alumni

Hi,

Please close this thread by giving correct and helpful answer to the helpful posts.

Regards,

Jagan.