Discussion board where members can get started with QlikView.
I have some SQL within Qlikview which when I try to run in SQL I get an error:
Conversion failed when converting the varchar value '$(vCurrentYearRAM)' to data type int.
So my variable is currently created like this:
let vCurrentYearRAM = right(YearName(today(),0,3),4);
When I simply change it to the following it works:
let vCurrentYearRAM = '2018';
I also tried the following and this does not work either:
let vCurrentYearRAM = num(right(YearName(today(),0,3),4));
Just use the function without any manipulation, like so:
let vCurrentYearRAM = YearName(Num(Today()));
simpler option is:
let vCurrentYearRAM =Year(Today());
That will return 2018 and when you expand it to the SQL query it should work.
What is the value you are getting from the variable? I am getting "2019"
May be try with Num# like Num(Num#(Right(YearName(today(), 0, 3),4)))
Sorry 2018 was a bad example.
Our fiscal year runs from April, so today the fiscal year is 2018-2019 so would want it to display 2019 really
I assume your issue arise from something different.
Here, the SQL should not 'see' $(vCurrentYearRAM) at all, a dollar sign expansion should have been replaced before sending the code to the SQL driver.
How does your script look like?