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

How to suppress row conditionally in crystal report?

Status
Not open for further replies.

bandarna

Programmer
Jan 2, 2003
122
US
I have a main report and subreport. It is linked with exp_vchr_id. It is working fine. Executing each row level for each exp_vhr_id and populating data.
However I need to modify sub report to pass a parameters in to it like p_elemet1,p_element2 this is creating a problem for me.

After I merged my subreport into my main report, when I ran report I am entering values for p_elemet1,p_element2, then subreport data is showing wherever it matches with parent exp_vchr_id and all other rows I am displaying only parent data not subreport data.
What I wanted to do now is I wanted to suppress parent row whenever no data found from the subreport.
Here is what I did:
1. Created a shared variable in sub report as:
Formula Field (v_code_blk)
whileprintingrecords;
shared Stringvar v_gl_code_blk := rtrim(ltrim({exp_vouchr_itm.gl_code_blk}));

2. Used that variable in main report as:
Created a formula field as
whileprintingrecords;
shared Stringvar v_gl_code_blk
3. In details section where my main repot data and subreport data is located, selected Section Expert  open the X-2 for Suppress(No Drill-Down) formula, and coded as follows
if IsNull({@v_code_blk}) then true else false

but it is not suppressing.

If I change code like this (reverting true false)

if IsNull({@v_code_blk}) then false else true then it is working and suppressing all the rows.

I need a help!

-nb
 
First the subreport must be in a section above the one you want to suppress, so it would need to be in detail_a if you want to suppress detail_b conditionally. You can format detail_a to "underlay following sections" to get the desired display (but you cannot suppress or hide detail_a). You should also have a reset formula in the main report both in the report header and in detail_c (this section can be suppressed):

whileprintingrecords;
shared Stringvar v_gl_code_blk := "";

Then use a suppression formula like this on detail_b:

whileprintingrecords;
shared Stringvar v_gl_code_blk;
v_gl_code_blk = ""//note no colon

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top