Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

michielvandegoo
Valued Contributor

Limit script loading using variables or other solution ??

I need to limit the data loaded. It has to be limited by year.

I created this:

let $YearFrom = input('Year from', 'Specify the first reporting year required');
if (isnull($YearFrom)) then
let $YearFrom = 1999;
end if ;

which nicely creates the variable $YearFrom.

I want to use the result of this input box to limit the load

This does not work:


LOAD
applymap('Date_map_Billing', DATE) as Billing_Date,
Month(applymap('Date_map_Billing', DATE)) as Billing_Month,
Year(applymap('Date_map_Billing', DATE)) as Billing_Year;
SQL SELECT * FROM Billing where Billing_Year > $YearFrom;

I'm lost in the world of sql.

How can I correctly use the value from the variable in limiting the load?

Your help is much appreciated!!

1 Solution

Accepted Solutions
Not applicable

Limit script loading using variables or other solution ??

Michiel try this

LOAD
applymap('Date_map_Billing', DATE) as Billing_Date,
Month(applymap('Date_map_Billing', DATE)) as Billing_Month,
Year(applymap('Date_map_Billing', DATE)) as Billing_Year;
SQL SELECT * FROM Billing where Billing_Year > $($YearFrom);

Talha





3 Replies
Not applicable

Limit script loading using variables or other solution ??

Michiel try this

LOAD
applymap('Date_map_Billing', DATE) as Billing_Date,
Month(applymap('Date_map_Billing', DATE)) as Billing_Month,
Year(applymap('Date_map_Billing', DATE)) as Billing_Year;
SQL SELECT * FROM Billing where Billing_Year > $($YearFrom);

Talha





michielvandegoo
Valued Contributor

Limit script loading using variables or other solution ??

SQL error: No value given for one or more required parameters.
Script line: SELECT * FROM txBilling where Billing_Year >2002
SQL SELECT * FROM txBilling where Billing_Year >2002

michielvandegoo
Valued Contributor

Re: Limit script loading using variables or other solution ??

OK, this work. I get the error because the number formats aren't correctly defined.

Thanks Talha. Appreciate this very much!

Community Browser