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

Hiding detail section based upon formulae?

Status
Not open for further replies.

rdoshi

Programmer
Jul 16, 2001
6
NL
Hi,

I have a report where I need to hide the detail section based upon the formulae. The formulae is to compare the value of amount of current record with previous record, if previous record amount is equal current record amount then hide the current record.

I did write this formulae in Supress formula of detail section but problem is that "Variable is not holding the old values though I have define that variable in at report header too.

Let me know if u know this problem.

Thanks,
Roopali Doshi

 
In the Suppress formula of the Detail section add...


Previous ({YourField}) = {YourField}
 
Thanks for ur reply but I did same already in the Suppress formula of the Detail section

********************
numberVar oldPrice;
numberVar currentPrice;

oldPrice := (previous({DW_SLS_HISTORY.NetAmountInvoiced_DWC})/ previous({DW_SLS_HISTORY.InvoicedQuantity}));
currentPrice := ({DW_SLS_HISTORY.NetAmountInvoiced_DWC}/ {DW_SLS_HISTORY.InvoicedQuantity});

if oldPrice <> currentPrice then
true
else
false;
***********************

But this doesnt work as I want the detail line to be printed only if the oldPrice <> currentPrice

Has Anybody got an idea about this?
 
Not sure why you are using variables, that just makes things tougher to troubleshoot. I thin the problem is that your line:

if oldPrice <> currentPrice then...

should probably say:

if oldPrice = currentPrice then...



If this still gives you grief, write a formula field called Price which is:
{DW_SLS_HISTORY.NetAmountInvoiced_DWC}/{DW_SLS_HISTORY.InvoicedQuantity}

Then use the formula suggested above by jjames as your suppress formula. Ken Hamady, On-site/Phone Crystal Reports Training/Consulting
Quick Reference Guide to using Crystal in VB
 
I did try this too but still hiding of the detail section doesnt work for those record where condition is true.

What next?
 
Put the condition:

Previous ({YourField}) = {YourField}

in a new formula field, place it on the detail band. Does it print TRUE and FALSE on the right details? Ken Hamady, On-site/Phone Crystal Reports Training/Consulting
Quick Reference Guide to using Crystal in VB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top