Formula to suppress a field if it is repeated in Crystal Reports

I have a view that shows data on crystal reports, where I have fields such as tariff, rent, stocks, gross and net.My the problem is that someone changes the tariff in the database, it will show 2 rows of the same record with different rates, which is normal behavior from the point of view of the database, but I want to suppress the monthly rental field to 0 if the same identifier has a different tariff or the rental is repeated in a new record.

ID Tariff Rental 1 20 390 1 15 390 

I want the Report Lease field to be suppressed if duplicates are based on an identifier. Currently, I used this formula in a crystal report to check previous field data and suppress if it repeats.

{DatabaseField} = Previous ({DatabaseField})

It works fine, but if the identifier does not match and the lease is repeated, then it will suppress what I do not want. I want it to suppress only the same identifier.

+6
source share
4 answers

You must write the formula in the suppression field. (No need to suppress if duplicated)

In the rental field {ID} = previous({ID}) and {rental} = previous({rental})

If the identifier and the rent are the same, then only the report will suppress the rent.

I think this will work for you.

+18
source
  • In Crystal Reports, right-click the Details section and select Section Expert.

    1. In the Section Expert dialog box, select the X + 2 button next to the Suppress command. The checkbox must remain unselected for this formula to work.
    2. In the Formula Editor dialog box, create a conditional formula that contains the following function to evaluate records for duplicate values ​​and suppress the Details row

Example: {Table.Databasefield} = Previous ({Table.Databasefield})

+1
source

I had to make a small change to the formula in the Janarthanan solution, adding brackets to make it work with Crystal XI.

I used:

 {ID}=previous({ID}) and {rental}=previous({rental}) 

this formatting variation presented in the edited question helped me solve a similar problem.

0
source

Put this to hide the field formula to hide.

if {myTable.ID} = previous ({myTable.ID}), then the truth is still a lie

0
source

Source: https://habr.com/ru/post/921064/


All Articles