Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Not applicable

SQL Statement in LET Statement

Hi All,

Can I use the SQL Statement in LET statement. For example I want to calculate the minimum date from a table initialize to a variable. So that it can be used in my calender.

For example I want do some thing like the below one to that I can use vDateMin in any of the variable for MinDate in my calender.


LET vDateMin = SQL Select min(d_entry_date) from Tbl_DWR;


3 Replies
Highlighted
Creator III
Creator III

SQL Statement in LET Statement

As per my knowledge you cant put sql query in a variable at script level but you can do it at the design / development level by defining variable in document.

Regards,
Shumail Hussain

Highlighted
Master
Master

SQL Statement in LET Statement

Dear Rikab,

Let Statement works like variable declaration and Initialization. So during that time you cant assign value from any backend tool.

Regards,

Sunil Jain.

Highlighted
Not applicable

SQL Statement in LET Statement

This can be work for you.

We can get a value from a table, such in that example:

Currrency:
LOAD * INLINE [
"X" , "XValue"
usd , usdValue
eur , eurValue
tl , tlValue
];
SET vCurrency = '=Minstring("XValue")';

So if you store your result on a table, you can use its columns, and take into a variable.
If we customize to your case, You can try this:

MinDate:
SQL Select min(d_entry_date) As mDate from Tbl_DWR;

SET vCurrency = '=Minstring("mDate")';