Author Topic: Switch mechanism  (Read 509 times)

Offline kanirudha

  • Full Member
  • ***
  • Posts: 5
  • Forum Citizenship: +0/-0
Switch mechanism
« on: 09 Jan 2008 02:36:11 pm »
Hi,

I have a list which I need to filter in a way so that by default it should pick up last 10 days of data(don't want to Hot Code every day). On the report page there are two calender prompts(?Start_Date?,?End_Date?) which users should be able to use after the first run. I need something like a counter or some thing which will changes itself after first run.
What I can do is put a value prompt on the page. Give two static values say, A and B. Let the parameter name be ?Switch?. I can set its default value to be A.
So now in the filter I can say:
Code: [Select]
(
(?Switch?='A' and [Filter_Date] between _add_days(Current_date,-10) and Current_date) or
(?Switch?='B' and [Filter_Date] between ?Start_Date? and ?End_Date?)
)

This will work when its possible to change the value of that static value prompt to B after first run.

Is it possible with JScript?

Thanks,
Anirudha

Offline Authoress

  • Associate
  • **
  • Posts: 2
  • Forum Citizenship: +1/-0
Re: Switch mechanism
« Reply #1 on: 14 Aug 2008 11:15:17 am »
You may get the desired results by simply adding a filter to your report like this:

trunc([Date])  >= trunc(add_months({ sysdate },-3)) and trunc([Date])  <= { sysdate }

The example gets all rows for the past 3 months. No prompt dates required.

You could use the add_days function to just get rows for the last 10 days. This are Oracle functions, so adjust for another vendor. HopeThisHelps  :)