Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I use the following variable to calculate the differences between 2 dates.
//Calculate differences between 2 dates
SET MonthDiff = Num(((year($2) * 12) + month($2)) - (((year($1) * 12) + month($1))) + 1);
LET vDateExampleEuropeanFormat = '18/05/2017';
LET vDateStartConsultant = 'date(date#(DateStart,' & chr(39) & 'YYYYMMDD' & chr(39) & '),' & chr(39) & 'DD/MM/YYYY' & chr(39) & ')';
LOAD * INLINE [
Consultant, DateStart
John, 20150126
Maria, 20151204
Paul, 20170912
];
It is working fine when I use MontDiff function in a table with vDateExampleEuropeanFormat variable. However when I use it with vDateStartConsultant I receive the error: garbage after expression: “)”
I am attaching an example.
Could you please help me with this issue?
Hi,
not '
=$(MonthDiff(vDateStartConsultant, Today()))
Hi,
thank you so much for your answer!
I am very confused. Could you please clarify why we have to use vDateStartConsultant in this case -Without “$” and quotes-? In the other example I put ‘$(vDateExampleEuropeanFormat)’-(With “$” and quotes) and it works well
=$(MonthDiff('$(vDateExampleEuropeanFormat)', Today())) //it works well
=$(MonthDiff('$(vDateStartConsultant)', Today())) //it DOESN’T work well
=$(MonthDiff(vDateStartConsultant, Today())) //it works well
Thanks in advance
Put both variables into a textbox and you will see that the first returned:
18/05/2017
and the second:
'18/05/2017'
and if the second variable is then called with single-quotes per '$(variable)' you will double the quotes and receive a (still) error in the result of NULL. This meant creating and calling a variable depends on eachother.
- Marcus