Link to home
Start Free TrialLog in
Avatar of John-S Pretorius
John-S PretoriusFlag for United States of America

asked on

Count string value instances seperated by a comma in field

I have a string value {dbo.CharConfidence} field that typically has 7 values separated by a comma (82,81,81,85,93,67,8) I am looking for a formula that will count the individual 'instances' separated by a comma. the example mentioned in bold  = 7
Avatar of Nitin Sontakke
Nitin Sontakke
Flag of India image

Are you sure you want to do this in Crystal Reports? Which db are you using? Will it be acceptable to have solution there instead?
Avatar of John-S Pretorius

ASKER

Thank you for your response Nitin, I run Crystal reports against a SQL database. Crystal also has some limited ability to do SQL queries. Crystal reports is what I typically use so it seems like the way to go.
In playing with some available commands I found the below statement that seems to be working in Crystal Reports :-
Ubound(Split({ZapData.CharConfidence},","))
To add some additional findings, it seems I'm closer but still have some challenges. Should my value have for example 7 commas as expected but the last value is 'null' (71,100,63,100,100, ) the results is also 7. The result for the example mentioned in brackets should = 6
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you and as always great solution.