cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a list of ids found in a group selection

Former Member
0 Kudos

Post Author: wm5

CA Forum: Formula

I am trying to create a report that has a grouping based on job ids. I would like to place in the heading of the report a list of all jobs ids included in the report.

I cannot figure out how to create this formula. Below is an example of the report. Thanks for any help.

For example,

Heading

Includes Jobs: 1, 2, 3, 4, 5

Groupings

Job 1

Jobs 2

etc.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Post Author: synapsevampire

CA Forum: Formula

Yeah, it makes sense that you wouldn't get a functioning formula when you elect to not post data types and show differing output for the same thing, right?

-k

Former Member
0 Kudos

Post Author: wm5

CA Forum: Formula

Thanks for the reply. The numeric formula worked for my situation. I had to wrap the formula in an if statement because I had a second Group Header and the Job IDs were duplicating depending on the number of rows in the second Group Header.

Here is the formula I used for my Group Header

whilereadingrecords;stringvar output;if instr(output, totext({kws_instance.InstanceID},0,"")) = 0 then (output := output & totext({kws_instance.InstanceID},0,"") & ", ";)

The formula for the Report Header worked without problems.

Crystal Report Version: 11.5.0.313

Thanks again.

Former Member
0 Kudos

Post Author: synapsevampire

CA Forum: Formula

OK, by heading I guess you mean the Report Header... Please try to use specific, real technical terms, it doesn't really save time to cut corners.

It's a shame that you didn't take the time to post your Crystal version, the database used, your data types, or basically anything technical here, forcing us to code for all possibilities and guess.

Also note that your expected output (I guess you figured that we'd know what the underlying data looks like based on this inconsistent output...) is contrary, in the header it shows numerics only, in the group it shows Job 1, Jobs 2, etc. Why would you show 2 different things for what is supposed to be the same data?

Anyway, one way to do this is by taking advantage of Crystal's reading records pass.

Place this formula in the group header (you can suppress it if need be):

whilereadingrecords;stringvar output := output & {table.jobid} & ", "

Place this formula in the Report Header:

whileprintingrecords;stringvar output;if len(Output) > 0 thenleft(Output,len(Output)-2)else""

If job is is a numeric, change the details formula to:

whilereadingrecords;stringvar output := output & totext({table.jobid},0,"") & ", "

I hope this solves your problem, and in future posts, please give us a break and desccribe what you have and what you need using examples.

-k