Search code examples
crystal-reports

calculating the percentage based on the number of records in the crystal reports


In my Crystal Reports I have a field called "PAYMENT", it has to be displayed according to the following requirement.

  • If there is only one RECORD in detail section then it has to display:
    PAYMENT=percentage
    
  • If there are MULTIPLE RECORDS in detail section then it has to display:
    PAYMENT=percentage+(percentage(total value)+remarks)
    

Can anyone please tell me how to do this?


Solution

  • You can use the following formula in CR to count the records

    CountRecords

    Count ({Table.PAYMENT})
    

    PaymentDisplay

    Then create another formula with your decision making:

    If COUNT FORMULA = 1 then DISPLAY OPTION 1 else DISPLAY OPTION 2
    

    I have not tested this but it should work.