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

Need formula for conditional display of section

Status
Not open for further replies.

tekniks

Technical User
Jun 27, 2003
98
US
Hi,

I am in need of a formula to suppress a Section in order to resolve this:

I have the following material types - A, B, C, D, E, F

1) If the records returned from the database are of Material Type A + Material Type B OR Material Type A + Material Type C, THEN Display the Section with Details 'Z'

2) If the records returned from the database are of any other Material Type from the list above with any combination, THEN Display other Section with Details 'Y'

Please let me know if you anything is not clear...

Thanks

TEK
 
TEK

You don't explain how the report is designed,

What sections do you have in the report
how is the data held in these sections, database fields or formulas

It would help if you showed the data and current layout along with the desired layout.

other useful information would be Crystal version and Database type

Gary Parker
MIS Data Analyst
Manchester, England
 
Let's assume you have a group on {table.project}, and you want the details to display as you described per project. Create three formulas:

//{@A}:
if {mat.type} = "A" then 1 else 0

//{@B}:
if {mat.type} = "B" then 1 else 0

//{@C}:
if {mat.type} = "C" then 1 else 0

Then go to format->section->details_y->suppress->x+2 and enter:

(
sum({@A},{table.project}) > 0 and
sum({@C},{table.project}) > 0
) or
(
sum({@A},{table.project}) > 0 and
sum({@B},{table.project}) > 0
)

Then go to format->section->details_z->suppress->x+2 and enter:

not((
sum({@A},{table.project}) > 0 and
sum({@C},{table.project}) > 0
) or
(
sum({@A},{table.project}) > 0 and
sum({@B},{table.project}) > 0
))

Not totally sure this is right, but it's worth a try.

-LB


 
Let me put it in a different way:

For all the Material Types returned for a given MatID if somehow I can get to know that if the returned dataset contains Material Type 'A' then display the section - Z else display section 'Y'.

That is if:

MatID Material Type
1 A
1 B
1 C

Then display Section -Z

OR if:

MatID Material Type
2 D
2 B
2 E

Then display Section - Y

Any formula(s) to conditionally display the section is needed.

Thanks

Tek
 
That is much simpler. First group on {table.MatID}. Using the formula I suggested earlier for {@A}, go to the section expert (format->section->details_z->suppress->x+2 and enter:

sum({@A},{table.MatID}) = 0

Then go to details_y->suppress->x+2 and enter:

sum({@A},{table.MatID}) > 0

-LB
 
what you haven't told us is the grouping of the report

I'll ASSUME it is something like this

Group 1 header table.Product
Group 2 header MatID
details
Group 2 footer
Group 1 footer

In this case the 2 subsection that you want optionally diplayed would PROBABLY be shown either in Group 2 footer or probably more likely Group 1 footer.

My question

IS there ALWAYS 3 components to a "product" ??? This is critical to the design of the suppression.

for example: could there be 4 components, 3 of which are A,B,C?? WOuld you still want Section Z shown or it must specifically be 3 components with A,B,C as the material used? A very critical question

If there are only 3 components per "Product" then the problem is simple

In the Group1 header you place this formula

//@Init (suppressed)
WhilePrintingRecords;
stringVar Array Components := ["","",""];
numberVar Position := 0;


In Group 2 header you place this formula


//@CheckMatID (suppressed)
WhilePrintingRecords;
stringVar Array Components ;
numberVar Position ;

Position := Position + 1;
Components[Position} := {Table.MatID};

NOW in the condition suppress in Section Z in Group 1 or 2 footer the formula would be

WhilePrintingRecords;
stringVar Array Components ;

Not("A" in Components and
"B" in Components and
"C" in Components);

Similarly in the Section Y you would use the following in the conditional suppress of that section

WhilePrintingRecords;
stringVar Array Components ;

"A" in Components and
"B" in Components and
"C" in Components;

But if as I suspect that there may be more than 3 components this must be modified.

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top