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

How to show a dummy text when all fields suppressed? 2

Status
Not open for further replies.

Loekje

IS-IT--Management
Mar 23, 2001
49
0
0
NL
L.S.

We have a report section that filters on two fields, they are only shown if they are a certain string in a field by supressing them if they aren't.

Works great, but we like to head the field with some text when the item does not have that field.
To be more precise in an example: we have a report that shows a personnel card. One of the fields is the passport number, which is just one of the possible records. So we suppres all but passport records.
But some personnel does not have a passport record and suppressing the rest leaves a blank space.

How do we get a dummy text in place? Like:
-- Passport : empty

Is it possible to create a formula in the line of:
IF NOT (previous section = Empty) then suppress
Or any other way? Giving all other peaple a passport record with ampty fields is not an option...

TIA,
Loek Gijben
 
LS,

I would split the section that gets suppressed based on the value into to sections A + B - and when there is no data - show the section with the message - when there is data - supress the section with the message.

To split a section - put your pointer in the gray left hand margin of the section you wish to split - right click - and choose Insert Section Below.

Create your supression formulas in the Section Expert.

I hope this helps

paulmarr
 
Hello paulmarr,

Thank you for your answer. I suppose it is the right track.
But what is the code to check whether or not there is data?
And can it be doen in Crystal Report/Basic syntax?

I've dug up some SQL code examples that should give the answer, but I'm almost SQL illiterate, let alone know how to incorporate it into a report.

It's something like:
IF EXISTS(SELECT * FROM table WHERE name="Passport") ..and then I'm lost.

Thanks again,
Loek Gijben
 
My suppression formulas tend to be along the lines of
// check for blank value
if {table.field}='' then true
//check for NULL value
else if isnull{table.field} then true
//otherwise show the field
else false

Hope this helps.
Shortya
 
For a complete absense of data, you can check any field IsNull(field). Remember that Crystal commands always stop when they meet a null, except when tested by IsNull.

In your case, it is different, data that may or may not quality. I'd do a running total applying the test. When it is zero, nothing was found.

That assumes the total can be reset each group, and that this is OK. If not, do a count in a variable instead. These too can be conditional, e.g.
Code:
whileprintingrecords;
if {@XS_Reply} then
NumberVar MyCount:=MyCount+1
IN this case {@XS_Reply} is a boolian, a formula field without an IF, meaning it will be True or False and can be tested directly.

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
I'm sorry that none of your suggestiosn will help. Or at least paulmarr's solution seems the most on track, but then I still have the problem how to check whether there is data in a section or not.

For ShortyA and Madawc solution I don't think I can check on Isnull while there sometimes *are* records filled, but they might not have the pointer to "Passport".

To be precise, the actual check would be for the table (certificates) not to have a record with the fields (certificates.Userid) = UserID and a field (certificates.certificate_type) = "Passport"
Where the UserID is the selection parameter.

Anymore suggestions anyone?
Thanks for all the trouble helping me...

Loek
 
It would be most helpful if you described your report layout, what groups you have, etc., and where you expect this result to appear. If you have multiple (using a multiple value parameter) users on the report, I'm assuming you would have a group on {table.user}. If there are potentially multiple records in the field where "Passport" might appear, then I think you should create a formula:

if isnull({certificates.certificate_type}) or
{certificates.certificate_type} <> "Passport" then "Empty" else
{certificates.certificate_type}

Then you could right click on this formula and insert a maximum at the group level and then suppress the detail section.

-LB
 
OK,

to wind up on my own question:
I did not read Madawc answer good enough I suppose. A counting variable does the job all right.

One thing I did to no avail before Madawc's answer was to make the dummy text section underlay the conditional section. But then the underlay did not appear when the following section was suppressed altogether. Thought this mistake is nice to mention...

Now I've ended by not making use of a counting variable. Instead I've created subreports with a filtered field.
It is not as slick as counting variables, but it is easier to understand and maintain by the application manager.
Also this subreport can be used in other reports as well, without having to add formula's to those reports.

It still leaves me with one last (but not urgent :) question how to get to the filter that is set during the new report wizzard (CR XI):
- first you select tables, then fields, then group by, then summarized fields, then filter fields.
Where can I refind this filter?

Thanks for all the help.
Loek Gijben
 
Use the menu, Report>Selection Formulas>Record, on Crystal 10.

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top