Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
Solved

# Crystal Formula

Posted on 2014-04-17
Medium Priority
226 Views
Is there a way to parse a data like
20|3.5|30|20|3.5|
and display the first number 20 and then add and show the rest  which is 3.5+30+20+3.5 = 57
The data is random sometimes like 44|20|20|36|
it keeps varying but the basic idea is to display the first number and add up the others and show.
0
Question by:Star79
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 2

LVL 23

Assisted Solution

Ido Millet earned 800 total points
ID: 40007271
See Split() function in Crystal's online help.  It would give you an array, and you can then loop through it.
0

LVL 101

Accepted Solution

mlmcc earned 1200 total points
ID: 40007525
What do you want displayed?

Building on Ido's idea

To display the first number

``````Split({YourField},'|')[1]
``````

To sum the remaining
``````Local StringVar Array myNumbers;
Local Number Var Total;
Local NumberVar Index;

myNumbers := Split({YourField},'|');
Total := 0;
For Index := 2 to UBound(myNumbers) do
Total := Total + Val(myNumbers[Index]);
Total
``````

mlmcc
0

LVL 101

Expert Comment

ID: 40009467
Ido's comment should have received some of the points.  I don't know if I would have come up with the SPLIT function immediately as the solution

mlmcc
0

Author Comment

ID: 40017669
How can I rearrange the points
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…