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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Message if No Data

Status
Not open for further replies.

ddnh

Programmer
Nov 25, 2002
94
US
What's the best way to create a formula to show a message if no data is available? Is there something you can do with counting records or something?

I'll be placing the formula on the report and suppress it if there is data available.

Any suggestions?

 
Dear ddnh,

I don't like to use textboxes with data fields if I can help it ... so as SV indicated in his post in the referenced thread, create a formula.

if Isnull({Incident.Incident #})
then
('No Data Returned for Selection Criteria'
& chr(13) &
RecordSelection
)
else ''

If you don't want to print the actual record selection criteria, but the values requested when populating parameters do the following:

Example: My selection criteria is:
//start
(If {?Status} <> 'BOTH'
then {Incident.State:} = {?Status}
else if {?Status} = 'BOTH'
then true
)
and
({Incident.Open Date & Time} in {?FDATE} to {?FTDATE})
//end

I would take that and use the following formula (parenthesis are very important below):

(
if Isnull({Incident.Incident #})
then
'No Data Returned for Selection Criteria:'
else ''
)
& chr(13) &
(
If {?Status} <> 'BOTH'
then 'Calls in Status ' & {?Status}
else if {?Status} = 'BOTH'
then 'Calls in Status O and C'
)
& chr(13) &
(
'Opened from ' & totext({?FDATE},"MM/dd/yyyy") &
' to ' & totext({?FTDATE},"MM/dd/yyyy")
)

Place the formula on the report where you want it to display the info and don't forget to right click/format field/Common Tab/Can grow ...

Using my example, when no records returned it shows:

No Data Returned for Selection Criteria:
Calls in Status O and C
Opened from 11/11/2004 to 11/12/2004

You could even use it as the report title ...

regards,
ro

Rosemary Lieberman
rosemary@microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top