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

Hide and Display Group Header based on conditional increment variable 1

Status
Not open for further replies.

sajisher

Programmer
Dec 3, 2003
45
US
Hi,

Have 2 Groups and details. Would like to Hide and Display the Group1 header if the rows in the details are greater than 0. The report brings in all the records and then filters in the Section Expert of the Details.

Right now using the following formulas in the report (CR9)but the variable noRows shows always 0 in the group2 header even though there are rows in the details. Any suggestions appreciated.

Details: @Calc (incrementing)
-----------
WhilePrintingRecords;
global numbervar noRows;

If {table.colum1}=1 and {table.column2}=-1 Then
noRows := noRows + 1;

Group2 Header: (displaying) but shows 0. In Section Expert would like to make group header hide and dsplay. if noRows=0 (suppress).
@Disp
--------------------
WhilePrintingRecords;
global numbervar noRows;
noRows

Group2 Footer: & in Group1 Header: (Initializing)
@Init
----------------------------------------------------
WhilePrintingRecords;
global numbervar noRows;
noRows := 0;

thanks
Saj
 
Variable results are generally only correct in footer sections, so you can't use the result to suppress a header.

I'm not understanding what = 0. You seem to be saying that if the two columns were added together to equal 0 then you would want to actually count the record, resulting in a non-zero value for the group. Can you please try another explanation?

-LB
 
Thanks for getting back.

Basically I need to Hide/Suppress a group header when there are no rows for that group and Display the group header when there are rows for that group. How this could be achieved.

-saj
 
Try a section suppression formula of:

count({table.field},{table.groupfield}) = 0

-LB
 
Thanks lbass, I tried

count({table.column},GroupName ({@GL_GL_Identifier})) = 0

This group is based on formula. It gives message 'This field cannot be used as a group condition field' and is pointing to @GL_GL_Identifier.

and the Group formula of @GL_GL_Identifier is:
-----------------------------------
if {Item.col1}<> "" Then
{Item.col1}+{Item.Page}+{Item.Cur}
else if {Item.col1} = "" Then
{Item.col4}+{Item.Cur}


Also, there is Details Section suppress as:
------------------------------------------
{Item.col2}=4098 or {Item.col2}=4114

-saj
 
Don't use the groupname field, use the groupfield itself:

count({table.column},{@GL_GL_Identifier}) = 0

-LB
 
thanks again, I tried
count({table.column},{@GL_GL_Identifier}) = 0

and it also displays the Group headers without rows becuase I think in the section detials I have the suppress formula used. So the report brings rows for that group initially but it is suppressed from displaying using suppress formula. Any workaround...

-saj
 
Please post the suppression formula used on the detail section.

-LB
 
Here it is - suppression formula used on the detail section.

{Item.State}=40 or {Item.State}=44

-saj
 
Create a formula {@notnullnor40nor44}:

if isnull({Item.state}) or
{Item.State} in [40,44] then 0 else
1

Then use a suppression formula like this:

sum({@notnullnor40nor44},{@GL_GL_Identifier}) = 0

-LB

 
Wonderful lbass!!works perfect..Millions thanks !!- Saved my day- Whole team waiting for this one since few days.
Read and tried various google methods and last resort posted here. u all rock..

-saj
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top