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

Array Parameter Passing

Status
Not open for further replies.

gpincomb

Programmer
Feb 11, 2004
12
US
I have a report that has a field in it that has multiple values and is comma delimited. I have to break apart this field into individual fields that I can group on. These individual fields have to remain in the same grouping,
i.e. Field contains: Cardiology, Pediatric Surgery, Rheumatology
Next Record: Allergy, Immunology, Pain Management

So I want a grouping that would be as follows
Allergy
Cardiology
Immunology
Pain Management
Pediatric Surgery

(Many more values in my file.)

I have gone through the use of Split and know about not creating a formula resulting in an array. I have tried putting these fields in a subreport and tried passing them back to the main report, but only get the first value of the array (or 2nd value if I subscript it with 2, or last value if I loop it with a counter determing my subscript #). I have even tried to define these values to fill a parameter field, but have had no luck in this regard either. Any help would be greatly appreciated. Thanks.
 
Are you saying that you want to do multi-level grouping, the groups being allergy within cariodology within immunology, etc. (or the other way round)?

If so, you would need to create a seperate formula for each level. In each formula, return the value of the array subscripted by the level number (1,2,...).

If I have misunderstood the requirements, perhaps you could clarify.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Sorry if I was not clear, but no I want all of my values in the same level of grouping. Also, I forgot to mention I am using CR 8.5.
 
So, allergy + cariodology + immunology would be one group? And allergy + cariodology + something else would be another? And these are all on the same level?

In that case, it looks like your grouping formula should return a string that consists of a concantenation of the relevant names. If that's right, why did you put them into an array?

Or am I still not getting the point?

Mike




Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
All specialties Allergy, Cardiology, etc. all need to be their own separate group. But are in a field in which they are already concatenated and comma delimited. So my first thought was to use the split function, which turns them into an array, which I do not know how to group on all of the values. These comma delimited fields exist in multiple records. And I use the word concatenated to illustrate that they are together in that field not that they come from other data elsewhere, because they don't, this is the way the database was designed and the data entered. I appologize that this seems to be confusing and I am willing to provide as much explanation as needed to help anyone understand where I am coming from with this and what I am trying to do.
 
OK, I'm beginning to get it. Sorry if I am being dense about this - not unusual for me.

So, you have an array containing a series of terms: allergy, cardiology, .... Each of those terms is in a separate entry in the array. You want each of those to give rise to a separate group, but all on the same level. So your first group would be allergy, the second group cardiology, and so on.

If that is correct, your grouping formula would simply return the array, subscripted by GroupNumber.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
The simplest solution for this is actually in the query design. Use a query (in MS access), View (in other DBMSs), Command (CR 9), or Stored Procedure to provide the data source for the report.

The SQL query used in one of these sources should use a UNION statment as follows:
--------------------------------------------------------
SELECT 1st_element in field as "Area", other fields from your_table
UNION ALL
SELECT 2nd_element in field, other fields from your_table
UNION ALL
SELECT 3rd_element in field, other fields from your_table
etc...
ORDER BY 1
--------------------------------------------------------

In your report, you can now simply group by "Area"

Cheers,
- Ido



CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
I think I did not explain very well, what it is I am trying to do exactly. So instead of muddying up the water here any more, I thought, I'd try to start over. If you're still interested in helping please see:
thread149-777216
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top