Hello to all,
I'M getting a parsing error while trying to apply the following logic in the data item:
[date] >= _add_months(?pDate?, -CAST(?pMonths?,INTEGER))
Or while trying the following logic:
If ([date] = _add_months (?pDate?, - ?pMonths? ))
Then ( [Total Sales] )
Else (0)
Or while trying the following logic:
[date] between _add_months(#prompt('pDate','token')#, -1* #prompt('pMonths','token')#) and (_add_months(#prompt('pDate','token')#, #prompt('pMonths','token')#))
Or while trying this:
[date] between _add_months(#prompt('?pDate?','token')#, -1* #prompt('?pMonths?','token')#) and (_add_months(#prompt('?pDate?','token')#, #prompt('?pMonths?','token')#))
Am i missing something like doing a cast on the [date] column ? Or something like it ?
Thank you all for any fast reply!
Is [date] actually a date? If not, then you need to cast it.
Same with pDate - it needs to be a date as an argument to _add_months().
yes [date] is of type DATE TIME and yes pData is a CALENDAR GREGORIAN prompt type.
Why don't you try simplifying the expression to get the correct syntax and then add in the necessary complexity bit by bit to isolate where you are going wrong.
[date] >= _add_months(current_date, -3)
then
[date] >= _add_months(?pDate?, -3)
then
[date] >= _add_months(?pDate?, ?pMonths?)
then
[date] >= _add_months(?pDate?, ?pMonths? * -1)
Ah, bdbits got there first with a more concise answer :)
Thank you all ... simple comma that i needed to replace by a semiolon ( ; )