Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Split string field for group heading

Status
Not open for further replies.

JessicajOwen

Technical User
Jan 31, 2006
9
GB
Hello,

I have a field that can contain up to two static string values, ValueA and ValueB. In some instances the field only has one string value in - it could be ValueA or ValueB, and in others it has both in any order, seperated with a comma.

I need to put this field into a group heading and split any instances where the field has the two values in so that I can do a count on how many times ValueA appears and how many time ValueB appears, regardless of whether they have been selected seperately or together.

I have tried using the split formula to seperate the values but get "the result of the formula cannot be an array", but I can't seperate the results into numerous fields and still display in the group heading...

Can anyone help, or suggest a way I can achieve my goal?

Thank you!
 
could you give a sample of the data on your field and which part you would like to be in the group.


-Mo
 
The field values can either be:

Buy with Confidence Application Pack
There are 2 instances of this
or

Buy with Confidence information Leaflet
There are 4 instances of this
or

Buy with Confidence Application Pack,Buy with Confidence information Leaflet
There are 3 instances of this
or

Buy with Confidence information Leaflet,Buy with Confidence Application Pack
There is 1 instance of this


My report has got to list the 2 values with a count of how many times it appears next to it. So I would expect to see:

Buy with Confidence Application Pack - 6
Buy with Confidence information Leaflet - 8



In other reports I have achieved this type of display by putting the field in as a group heading and inserting a summary count on the group heading line as well, and supressing the detail lines.

Jessica
 
if there are only two values on your field you could use two formulas, eg;

@CountVal1 =

if instr ({YourTable.Field1},'Buy with Confidence information Leaflet')= 1 then
1
else
0

and the other

@CountVal2 =

if instr ({YourTable.Field1},'Buy with Confidence Application Pack')= 1 then
1
else
0

then add a summary for each one


-Mo
 
THese formula's work for the count summaries, thanks - but I still see 8 different count summaries -
one for each combination the data appears in the field in (4 combinations) and the extra 4 as I have 2 count fields.

I'm trying to format the report so that I literally just see two lines, one with a total count for "Buy with Confidence Application Pack" and one with "Buy with Confidence information Leaflet"

Apologies... I'm new to Crystal, so I'm probably missing something very obvious! ..I've spent weeks going round in circles trying to get the report to do what I want, and always seem to come back with the same results!!

Your help is really appreciated,
Jessica
 
try something like

@Couter1

whilereadingrecords;
numbervar i;
if instr ({YourTable.Field1},'Buy with Confidence information Leaflet')= 1 then

i := i + 1;

i

and place it at the report footer


-Mo
 
thank you very very much, a combination of your first suggested formulas put in the report footer works!!!!

THANK YOU :)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top