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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How Do I Separate a String then Combine Results?

Status
Not open for further replies.

DMunoz

Technical User
Jan 19, 2001
8
US
I have a Database Field (which are Regions) in Group Header #1 with values appearing as:

Administrators;West Coast
Consulting
Midwest
Midwest;West Coast
Northeast;West Coast
Administrators;West Coast
West Coast

I need to be able to separate the Regions, which I can do, (sort of like pulling First & Last names) but then merge (Group) all Administrators together, Midwests together, West Coasts together and so on.

I've tried the Select Expert and only listed the individual Regions (Midwest, West Coast, ect.) however, then the "Administrators;West Coast" or the "Midwest;West Coast" and so on doesn't get pulled.

I've tried declaring the separated results and then adding the values together, but then I'm back to square one.

So the question is, how can I separate the data and Group them?

I'm new at formulas, so if you can, be "gentle"!!!

Thanks in advance!

:)
 
DMunoz: The solution to your problem is to use the Specified Order option when grouping your Regions. This will allow you to create for example 2 Named Groups, one Administrators and one MidWest. The process of creating a Named Group will then ask you to define how a record gets included in the Named Group - you would use for example Region startswith Administrator or Region like *MidWest* etc.

David C. Monks
david.monks@chase-international.com
Accredited Seagate Enterprise Partner
 
Unless you are trying to get one record into two groups at the same time. Specified order won't do that.

Take, for instance, the record with the value:

Midwest;West Coast

is that supposed to show up in two different groups? Ken Hamady
Crystal Reports Training and a
Quick Reference Guide to VB/Crystal
 
As you say Ken, specified order alone won't create a solution for 1 record occupying 2 groups as in Midwest;West Coast. I would investigate the use of embedded subreports liked by a formula field in each (main and sub) which take respectively the first argument and the second i.e. formula in main is left(Region,instr(Region,";")-1) and formula in sub is mid(Region,instr(Region,";")+1). This would have the effect of linking West Coast (on its own) to any entry in the sub with West Coast as a second argument.

You could then use shared variables to obtain the info you need out of the subreport or display relevant fields whatever you require. David C. Monks
david.monks@chase-international.com
Accredited Seagate Enterprise Partner
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top