cancel
Showing results for 
Search instead for 
Did you mean: 

Create groups based on formula results

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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.

Former Member
0 Kudos

So what results are you getting? Is the formula returning blanks for some records, thus giving you a group that has records grouped on a blank?

Are you sure that all scenarios are covered in your formula?

Former Member
0 Kudos

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"

else "Does not fit into other categories"

Use the above formula and you may want to check your criteria if you have a lot appearing in the last "Does not fit into other categories" group.....

former_member230846
Contributor
0 Kudos

Hi Derek,

Did you create a group on the formula, by going to the menu Insert|Group... and selecting the formula you created?

Regards,

Wallie

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Dereck

How did you sorted this out.

Sunil

Former Member
0 Kudos

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

former_member230846
Contributor
0 Kudos

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

Former Member
0 Kudos

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