Re: Reports 6i - query returns no data
Date: Sun, 14 Jan 2001 22:35:17 GMT
Message-ID: <FQp86.5236$J%.529374_at_news.flash.net>
two suggestions come to mind:
[Quoted] 1) accept the parameters and in a before-report trigger, pass the parms to a
[Quoted] stored procedure that builds a ref cursor the same as the report. Open the
[Quoted] cursor and fetch 1 row. If you fetch a row, great, return (true). If not,
[Quoted] return (false) and the report will stop. Prior to returning false, use the
[Quoted] srw.message to display an error dialog "report returned no data" or
something similar.
2) do the same thing in a driving form and display the error prior to starting the report, and ask the user to change the parameters.
3) Create a report level "counter" that summarizes on the entire report. [Quoted] Make it use Count as it's function and count the primary key column (or any [Quoted] column for that matter). Put a before report trigger that references this [Quoted] counter, ie.
if :my_report_counter = 0 then
srw.message('no rows found'); return (false); else return (true);
end if;
- it will take a little longer to run with this as the entire report [Quoted] has to be generated because you've based a counter on it and are using it in [Quoted] the before-report - ie. it has to count all the rows, but returning true if [Quoted] you found rows is good because now the report will display ok. The false [Quoted] causes it to stop. You'll get the error about the before report trigger [Quoted] returning false, but the message will be displayed and you exit back to the form.
[Quoted] Let me know if any of this made sense or was helpful. That will be 25 cents please... ;)
<pehaw_at_my-deja.com> wrote in message news:93s19o$5ts$1_at_nnrp1.deja.com...
> Hello,
>
> I'm converting lots of Microsoft Access 2.0
> reports to Oracle Reports 6i on NT.
>
> I have a very simple request - how do i detect
> when a query in Reports selects no rows? I am
> passing parameters to Reports 6i from Forms 6i
> and, obviously, this may or may not result in
> data being selected by the queries in Reports.
>
> If no rows are returned, I need to do action X,
> if rows are returned then display the Report as
> normal.
>
> Thanks for any help
Received on Sun Jan 14 2001 - 23:35:17 CET