Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everybody,
I have a selection on date like 18/03/2014
THEN max(DateExerNum) = 18/03/2014
who can explain why
This
SET vPriorMaxDate = "=addmonths(max(DateExerNum), -12)";
returns 31/12/1899 WRONG VALUE
This
SET vPriorMaxDate = "=(max(DateExerNum)-365)";
returns 18/03/2013 RIGHT VALUE
Best regards
Chris
Thank you Gysbert
you gave me the missign clue
SET vPriorMaxDate = "=num(addmonths(max(Bud.DateExerNum), -12))";
best regards
Chris
Could you post a sample that demonstrates the issue?
Hi, I did a little inline load and put your two SET expressions in the load script. Both return the same correct result when used in a text box, for example.
What are you doing to set DateExerNum?
Its evaluating the first expression. But I dont understand the dfference between let and set here..both of them working in a similar way. I have used this exp:
set v2="=addmonths(max(Date),-12)";
This works fine.
Let: Calculates the expression assigned to it and sets the expression result to the variable.
Set: Assigns the value(or expression which is after the equal sign) as it is without compute.
Example:
Set vVar=2+3; //vVar has the expression 2+3 as value and you have to compute it using $(vVar) which returns 5
Let vVar=2+3;//vVar has the computed value 5
It doesn't matter too much with strings, as in this case, as it works either way.
The addmonths function will return a date as a dual value, e.g. with a numeric value and as a formatted string. That string is probably not interpreted as a date when you use it later, but instead as 18 divided by 3 divided by 2013. That returns a very small number (close to 0) that when shown as a date returns a date close to the start of the calendar (day zero).
Hi Gysbert,
Yes i could check the result hasn't a date format but i can't use date function like
SET vPriorMaxDate = "=date(addmonths(max(DateExerNum), -12))";
which returns the same wrong result
Thank you everybody for your answers
Chris
Thank you Gysbert
you gave me the missign clue
SET vPriorMaxDate = "=num(addmonths(max(Bud.DateExerNum), -12))";
best regards
Chris