Skip to Content
avatar image
Former Member

Create groups based on formula results

I've got a report where I need custom groupings based on a formula. Two fields need to be compared against one another. Based on the results groups need to be created. The results wll be 3 scenarios resulting in 3 different status possibilities:

Scenario 1 - If Field B >0 and Field A < Field B then Status ="Paritally Recevied"

Scenario 2 - If Field A =Field B then Status ="Recevied"

Scenario 3 - If Field B =0 then Status ="Not Recevied"

So the 3 groups would be Partially Received, Received, Not Received and all are based on running all report records through the formula before displaying them in those groups.

I have no idea of the correct syntax for this but have soem experince in the Crystal Reports formula deisgner. I also don't know how to add the correct formula to the group paramters,

Any help is appreciated.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

5 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 02, 2008 at 06:55 PM

    The formula seemd to work for each record but it is not performing the analysis on all records and then sorting and grouping correclty. It does it record by record. I need all records analized and then grouped and sorted accordingly.

    Thanks for your help.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 02, 2008 at 03:20 PM

    Try this formula

    If Field B >0 and Field A < Field B then "Paritally Recevied"
    else If Field A =Field B then "Recevied"
    else If Field B =0 then "Not Recevied"

    insert a group using this formula tha gives three groups like

    Partially recevied

    Recevied

    Not Recevied

    Regards,

    Raghavendra

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 02, 2008 at 06:54 PM

    Hi Derek,

    You might need to include 'whilereadingrecords;' at the beginning to specify when the formula is to be evaluated. Groups are created during the whilereadingrecords phase, and may need to be added.

    For example, create a new formula under the Field Explorer and enter the below syntax by replacing Field X with your database field. Then create a new group using your formula.

    ================================

    whilereadingrecords;

    If Field B >0 and Field A < Field B then "Paritally Recevied"

    else If Field A =Field B then "Recevied"

    else If Field B =0 then "Not Recevied"

    ================================

    Regards,

    Wallie

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 09, 2008 at 01:22 PM

    Thank you for your help with this thred. The replies seemed to work.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 03, 2009 at 03:09 PM

    Hi Dereck

    How did you sorted this out.

    Sunil

    Add comment
    10|10000 characters needed characters exceeded