Solved

Crystal Formula

Posted on 2014-04-17
5
216 Views
Last Modified: 2014-04-23
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.
Please help.
0
Comment
Question by:Star79
  • 2
5 Comments
 
LVL 22

Assisted Solution

by:Ido Millet
Ido Millet earned 200 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 100

Accepted Solution

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

Building on Ido's idea

To display the first number

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

Open in new window


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

Open in new window


mlmcc
0
 
LVL 100

Expert Comment

by:mlmcc
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

by:Star79
ID: 40017669
How can I rearrange the points
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question