Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Initialize an object date prompt before running a report

Status
Not open for further replies.

gruposenda

Programmer
Jan 11, 2007
51
MX
Hi :
Is there a way to initialize a date prompt before running a report. This date prompt is in the report page.
I have an optional filter that uses the data from this object. But, when I enter in this report I need that the filter takes a defult date. This is my filter : [TPO_CDFecha] between ?pardatefrom? and ?pardateto?. I used a code in java to initialize the date prompt, but it only works after running the first time the report.

Thanks in advance
 
I don't have the perfect solution, but maybe you could try these:

Solution 1) Add a prompt page with a Date Prompt so as to set you dates before running the prompt.

Solution 2) Add another 'Yes'/'No'(default selection) prompt (parameter ?activate?) in your Report Page so as to activate/deactivate your Date Prompt. I mean, you filter will be like :

(([Date] between ?datefrom? and ?dateto?) and (?activate?='Yes'))
or
(([Date]='<default_date>') and (?activate?='No'))

Therefore, when you run the report, the second part of the filter will be applied as ?activate?='No'. Then, in order to change the date range, you'll need to switch to 'Yes' and use the Date Prompt.
 
Thanks for your idea.
I used a Text Box Prompt to simulate active and deactive. I set the filter like ([TPO_CDFecha] >= _add_days(current_date,-18) and ?Activar-desactivar? <> '1') and it works fine, but if I write in the filter
([TPO_CDFecha] >= _add_days(current_date,-18) and ?Activar-desactivar? <> '1') or
([TPO_CDFecha] between ?pardatefrom? and ?pardateto? and ?Activar-desactivar? = '1') it does not work fine. Is there any idea of what is happening ?
Thanks again
 
What do you mean "it does not work fine"?

When you enter '1' in your Text Box Prompt, your date is not in the range of selected dates?

I'm not sure about that, but I remember that "[Date] between ?from? and ?to?" is not exactly equivalent to "[Date]>=?from? and [Date]<=?to?". "between" may do
[?from?;?to?[
or
]?from?;?to?].
 
Thanks a lot, for all your time dedicated to this thread.
When I run the report with the filter :
([TPO_CDFecha] between _add_days(current_date,-day(getdate()+1)) and _add_days(current_date,-1) and ?Activar-desactivar? <> '1') it works fine.
-----------
If there is a filter like this :
([TPO_CDFecha] between _add_days(current_date,-day(getdate()+1)) and _add_days(current_date,-1) and ?Activar-desactivar? <> '1') or ([TPO_CDFecha] between ?pardatefrom? and ?pardateto? and ?Activar-desactivar? = '1') I Just added the condition 'or' and I Have the problem, because the filter does not work. It seems like if I do not have any filter. This is only just for the first time. If I run the report once again it will work fine, not matter if there is '1' or '0' in Activar-desactivar.
Thanks in advance.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top