Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
vireshkolagimat
Creator III
Creator III

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
Peter_Cammaert
Partner - Champion III
Partner - Champion III

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.

View solution in original post

4 Replies
m_woolf
Master II
Master II

What is the contents of vExpStartDate?

Peter_Cammaert
Partner - Champion III
Partner - Champion III

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
Creator III
Creator III
Author

It is showing as <Null>

Peter_Cammaert
Partner - Champion III
Partner - Champion III

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.