BusinessObjects Board

How to create a prompt to get previous month

Hi There,

I need a create a prompt such that, if a report runs every 2nd of the month. it supposed to pick previous month (start date & end date) as prompt for data retrieval.

How to achieve this requirement? Database is Oracle.

Thanks in advance.


Praveen8367 (BOB member since 2010-11-27)

Hi,

This sticky topic can help you:


Marek Chladny :slovakia: (BOB member since 2003-11-27)

Thanks Marek. Will look into this and try to figure out a way…Thanks for your time. Have a goo day!


Praveen8367 (BOB member since 2010-11-27)

you can use a case statment to decide if it’s the 2nd.
and you can use ADD_MONTHS(YOUR_COLUMN,-1) to recieve the date 1 month before the date in “YOUR_COLUMN”

For example:


SELECT ...
FROM ...
WHERE
TABLE.DATES >= CASE WHEN TO_CHAR(SYSDATE,'DD')='02' THEN ADD_MONTHS(@PROMPT('FROM'...),-1) ELSE @PROMPT('FROM'...)  END
AND TABLE.DATES <= CASE WHEN TO_CHAR(SYSDATE,'DD')='02' THEN ADD_MONTHS(@PROMPT('TO'...),-1) ELSE @PROMPT('TO'...)  END

Hope this helps!


Dragoran :israel: (BOB member since 2009-07-30)