Solved

Crystal Formula

Posted on 2014-04-17
5
218 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

726 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