Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Community,
I have a problem with using a variable in a script.
See here:
Data:
LOAD *,
((Year(contract_end_date_cur)-year($(v_target_date)))*12+month(contract_end_date_cur)-month($(v_target_date))) as contract_term_remain;
Directory;
LOAD main_unique_id,
customer,
asset_model,
contract_start_date,
contract_end_date_cur
FROM
lease.one_import.xlsx
(ooxml, embedded labels, table is main);
let v_target_date = today();
QV returns me this error:
Error in expression:
')' expected
Data:
LOAD *,
((Year(contract_end_date_cur)-year(21.09.2017))*12+month(contract_end_date_cur)-month(21.09.2017)) as contract_term_remain;
I checked my expression. There's definetely not a ) missing.
Hope anyone can help me out here.
I could imagine that the format of the variable is causing the error. Therefore either change the content of your variable to num(today()) or maybe floor(today()) or change the call of the variable to '$(v_target_date)'.
- Marcus
Looks fine for me as well ....
does the script continue, i.e. why is there a ";" at the end of the statement?
Else would suggest to rewrite the expression (sometimes there might still be a bracket at the very right of the text),
or go through step-by-step.
I could imagine that the format of the variable is causing the error. Therefore either change the content of your variable to num(today()) or maybe floor(today()) or change the call of the variable to '$(v_target_date)'.
- Marcus
"does the script continue, i.e. why is there a ";" at the end of the statement?"
No, the script just ends there.
I tried to rewrite the expression several times, but the brackets are fine.
Thank you very much, it finally works !!
Your solutions
floor(today()) works,
'$(v_target_date)' works,
num(today()) does not work
THX!!