Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hi, i want to get this variable to work in my Expression, but it is not working
i defined in the script the variable like this
SET vL.CustomerTimestampPrevMonth=chr(39)&date(addmonths(date#(GetFieldSelections(customer_timestamp),'YYYY/MM'),-1),'YYYY/MM')&chr(39);
and after running the script, i see in the Variable Overview under Settings that the variable is shown as:
chr(39)&date(addmonths(date#(GetFieldSelections(KUNDE_ZEITSTEMPEL),'YYYY/MM'),-1),'YYYY/MM')&chr(39) , which is not working in my Expression.
It works when i manually add the " = " sign infront of it in the variable overview. However i cannot get to create the complete variable expression in the script.
I also created this in the script,
SET vL.CustomerTimestampPrevMonth='=chr(39)&date(addmonths(date#(GetFieldSelections(customer_timestamp),'YYYY/MM'),-1),'YYYY/MM')&chr(39)';
but in the varibale overview appears as:
'=chr(39)&date(addmonths(date#(GetFieldSelections(customer_timestamp),'YYYY/MM'),-1),'YYYY/MM')&chr(39)'
and it is also not working. Any idea why not? (i tried with chr(61) too, same result)
thanks
If you just want to add the equal sign:
SET vL.CustomerTimestampPrevMonth= =chr(39)&date(addmonths(date#(GetFieldSelections(customer_timestamp),'YYYY/MM'),-1),'YYYY/MM')&chr(39);
Have you tried using LET?
LET vL.CustomerTimestampPrevMonth=chr(39)&date(addmonths(date#(GetFieldSelections(customer_timestamp),'YYYY/MM'),-1),'YYYY/MM')&chr(39);
Hi,
How you using in the expression?
You Tried
$()
$(=)
Mark
yes, did not work
yes, it did not work
I use quite often double-quotes around variable-definitions like:
SET vL.CustomerTimestampPrevMonth="=chr(39)&date(addmonths(date#(GetFieldSelections(customer_timestamp),'YYYY/MM'),-1),'YYYY/MM')&chr(39)";
Also the suggestion from Mark to use $-sign expansion is often helpful: The Magic of Dollar Expansions
However much easier are pure numeric values to handle. In this case maybe with a additionally field MonthCounter - Re: Howto make a variable to calculate quarters regarding year changes? - which is associated to [customer_timestamp] and then to use:
set var = "max(MonthCounter)-1";
which avoids the whole formatting-stuff.
- Marcus
HAve you just tried
Set vL.CustomerTimestampPrevMonth = date(addmonths(date#(GetFieldSelections(customer_timestamp),'YYYY/MM'),-1),'YYYY/MM')
As you seem to be adding the actual ' symbol in?
Or maybe purgechar(vL.CustomerTimestampPrevMonth,'chr(39)') in a text box and see if that is the right result?
Mark
thanks, i am trying this
If you just want to add the equal sign:
SET vL.CustomerTimestampPrevMonth= =chr(39)&date(addmonths(date#(GetFieldSelections(customer_timestamp),'YYYY/MM'),-1),'YYYY/MM')&chr(39);
it is right like this, thks