Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

vireshkolagimat
Contributor II

script error

Hi All,

Could you please let me know what is wrong in the below script. When i execute the below script, getting below error message.


Error in expression:

Year takes 1 parameter

[InvExp Calendar]:

LOAD DISTINCT

    Temp_Date as ExpiryDate,

    MonthStart(Temp_Date) as ExpiryMnthDate,

Year(Temp_Date)   as [InvExpYear],

Month(Temp_Date) as [InvExpMonth],

Month(Temp_Date)&'-'&Date(Temp_Date, 'YY') as [InvExpMonthName],

num(Month(DATE(Temp_Date,'DD/MM/YYYY')))        as [InvExpMonthNumber],

Date(Temp_Date, 'YYYY-MM')   as [InvExpiryMonth],

((Year(Temp_Date) - Year($(vExpStartDate)))*12) + Num(Month(Temp_Date)) as InvExpRollingMonth;

LOAD DISTINCT

($(vExpStartDate) + IterNo() - 1)   as Temp_Date

AUTOGENERATE (1)

WHILE $(vExpStartDate) + IterNo() - 1 <= $(vExpEndDate);

Thank you.

Regards,

Viresh

1 Solution

Accepted Solutions

Re: script error

There you have it. The code won't work if you do not enter acceptable values in variables vExpStartDate and vExpEndDate.


To test it out, you an create these variables in Settings->Variable Overview and supply values for them.

4 Replies
Highlighted
mwoolf
Honored Contributor II

Re: script error

What is the contents of vExpStartDate?

Re: script error

Probably one of your variables that are used in $-sign expansion, in reality expands to ... nothing. You know, this error can mean that you either specify too many or too few parameters for the Year() function.

Check the spelling of your variables, and if they check out fine, check their content.

vireshkolagimat
Contributor II

Re: script error

It is showing as <Null>

Re: script error

There you have it. The code won't work if you do not enter acceptable values in variables vExpStartDate and vExpEndDate.


To test it out, you an create these variables in Settings->Variable Overview and supply values for them.

Community Browser