Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

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

Tags (3)
2 Replies
mwoolf
Honored Contributor II

Re: Changinig Variable value

Put the single quotes around the $ expanded variable:

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

Not applicable

Re: Changinig Variable value

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

Community Browser