We help IT Professionals succeed at work.

sum String field values of 0 and 1 in Crystal Reports

Beth S
Beth S asked
on
178 Views
Last Modified: 2017-04-01
I have four fields that are all 144 char in length and data type is String.  The value is either 0 or 1 with no separating characters or spaces, and I want to sum the string.  Data example is:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111111111111111111111111111111111111111

Thank you in advance for your assistance!

BethS
Comment
Watch Question

lcohanDatabase Analyst
CERTIFIED EXPERT

Commented:
Not sure what do you mean by "sum the string" - put them all together side by side or perform a actual SUM function on the values?
If you just want to concatenate all data you can add a new filed that contains the value from all these 4 fields combined together.

Author

Commented:
To clarify, I want to sum all the "1" values.  For example, the value I would like to be calculated from my data example above would be "54" as there are fifty four instances of the number 1.
Mike McCrackenSenior Consultant
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2013

Commented:
What reporting tool are you using?

mlmcc
Senior Consultant
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2013
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Method 2 did the job! Thank you so much for answering my question and helping me learn! :)
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.