Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Changinig Variable value

Hi

I have a variable in my load script that holds the value of last modified date.  This part works fine and hold value of Var_Max_Of_Sales_Modified_Date=2014-08-12 16:03:31

LOAD *
Resident Sales_Fact
Order By Modified_Date;
Let Var_Max_Of_Sales_Modified_Date=Peek('Modified_Date', -1, 'Sort_Sales');

Then I try to use this variable value in the next SQL script and it fails

Select * from sales_fact  where modified_Date=$(Var_Max_Of_Sales_Modified_Date);

The SQL scripts expects where modified_Date='2014-08-12 16:03:31' basically these single ticks around the variable value.

I would appreciate any help.

Thanks

2 Replies
m_woolf
Master II
Master II

Put the single quotes around the $ expanded variable:

Select * from sales_fact  where modified_Date='$(Var_Max_Of_Sales_Modified_Date)';

Not applicable
Author

Thanks . It goes through without an error so I guess it should work. It is still not getting the desired rows as now the SQL statement is expecting the ending numbers after seconds.

so how can I format Modified_Date so it is

2014-08-12 16:03:31.643

and not

2014-08-12 16:03:31

Below is what I used before it is loaded into variable

Date(Modified_Date, 'YYYY-MM-DD hh:mm:ss') as Modified_Date