# Crystal Reports' formula

Printable View

• March 5th, 2015, 08:51 PM
NewCrystalGirl
Crystal Reports' formula
Hi,

Can anyone help me with Crystal Report formula?

I want to create a report like below layout:

Attachment 33361

So basically I want to display the those charges to specific a table: Charge #1, Charge #2 and Charge#3 with conditions (below)

So, here are the conditions:
- Charge #1: Account ID is in (1,2 and 3)
- Charge # 2: Account ID is in (4,5 and 6)
- Charge # 3: Account ID is in(7,8 and 9)

So, there are three fields that involve on the report I want to create, Account Description (A,B,C,D,E and F), Charges, and Account ID (1,2,3,4,5,6,7,8 and 9)

So what I did, I created three formula for charge field. Charge1, Charge2 and Charge3. I placed them on the detail fields and do the select expert on each charge.

1. The Select expert on Charge1, I place the Account ID is equal to 1,2 and 3.
2. The Select expert on Charge2, I place the Account ID is equal to 4,5 and 6
3. The Select expert on Charge3, I place the Account ID is equal to 7,8 and 9

but when I preview the report, the report returned blank. Anyone know how to do the formula so I can display the report as on this attachment?

Thank you so much for all the help
• April 7th, 2015, 09:48 PM
jnole
Re: Crystal Reports' formula
Try to avoid using record selector. Sometimes record selector displays blank data on the report (for me...). You can create a formula to accomplish what the record selector does (for the most part).

To my understanding, you want to use a specific charge number for accounts.
You can accomplish your need using logic formulas.
The first step will be to create a formula to group charge numbers.
1. Create a formula and call it "Charge"
2. In the formula, create a Crystal Syntax logic statement:
If [Account ID Field] in ["1","2","3"] then [Charge#1 Field] else
If [Account ID Field] in ["4","5","6"] then [Charge#2 Field] else
If [Account ID Field] in ["7","8","9"] then [Charge#1 Field]

Note:: If your Account ID's are numbers and not text, then take out quotes [1,2,3] . If your data is text, then you will need to create another formula to convert your text to number (for totaling purposes)

Add the following fields to your report to obtain what you wanted. If needed, you can add a running subtotal.
[Account ID Field] [Charge]