Crystal Formula

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.
Star79Asked:
Who is Participating?
 
mlmccConnect With a Mentor Commented:
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
 
Ido MilletConnect With a Mentor Professor of MIS at Penn State Erie and Owner, Millet SoftwareCommented:
See Split() function in Crystal's online help.  It would give you an array, and you can then loop through it.
0
 
mlmccCommented:
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
 
Star79Author Commented:
How can I rearrange the points
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.