Diplay values passed in parameter form when no data found [message #666458] |
Mon, 06 November 2017 06:09 |
|
UsterSa
Messages: 8 Registered: November 2016
|
Junior Member |
|
|
I have a report that uses a group above, now I pass two parameters on it. now i want to display the the headings in the group about above when the query returned nothing.
exaple : in the parameter form if i put emp id and location.
if the details found everything is displayed correctly.
when no data found I want to see . there person and location even if the details are not available.
|
|
|
Re: Diplay values passed in parameter form when no data found [message #666467 is a reply to message #666458] |
Mon, 06 November 2017 13:55 |
|
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
(Sorry, I misunderstood the question you sent via PM)
By far the simplest solution is to display parameter values directly, using the ampersand notation, such as
Emp: &par_emp_id, Location: &par_location
As it would display those values regardless your query returns rows or not, you'd have to use a format trigger (either for the frame that encloses those fields, or for each field itself) which returns a Boolean, i.e. TRUE if your query doesn't return anything and FALSE if it returns something.
It means that you'd, actually, execute the same "main" query twice - once in order to figure out the outcome and another time to display the result set. It might be OK if query is a simple one and executes fast. If not, a workaround might be to create a table, populate in it After Parameter Form trigger, let report's main query select data from that temporary table and display the result. A format trigger would simply check whether there's anything in that table or not.
Or, probably a better idea, use a summary column with the COUNT function and *count* EMP_IDs; then you'd use that value in the Format Trigger.
Yet another option is to use UNION set operator and append yet another SELECT statement to the original query, such as
select emp_id, emp_name, location from your_table
where emp_id = &par_emp_id
UNION
select &par_emp_id, null, &par_location from dual
That option might be impractical if query returns many columns (so you'd have to include a lot of NULLs).
|
|
|
|