cancel
Showing results for 
Search instead for 
Did you mean: 

Building/Reporting arrays in Crystal Reports 2013

scott_selph
Participant
0 Kudos

Running CR2013.  I need assistance in formatting the reporting of an array.  I know very little about arrays, as I'm just getting into them.

I have the following as an example dataset.  Short version is a list of items where the ProcessID will have the same data item repeated various time and the changing data is in the JOBOPS field.  I need to report the ProcessID once, and the JOBOPS array (based upon ProcessID) on the same line.  There are multiple fields to display on the detail section, however JOBOPS is the only array that needs to be reported.

I have Initialize, Load, and Print Array formula fields.  However I can't get the completed array to display only once on the detail section.  It loops through each value and increments the array values as it creates the array.

INT: (Report Header)

shared stringVar array JobOps := "";

Shared numberVar x := 1;

LOAD: (Details)

Shared numberVar x;

Shared stringVar array JobOps;

JobOps [x] := {JobOperations.jmoProcessID};

redim preserve JobOps[UBound(JobOps)+1];

x := x+1

PRINT: (Details)

Shared stringVar array JobOps;

Join (JobOps, ", ")

Thanks in advance!

Dataset:

ProcessIDJOBOPS
123INS
123PROG
123QA
124TPL
124INS
124PROG
124INS

Current Output:

ProcessIDJOBOPS
123INS
123INS, PROG
123INS, PROG, QA
124TPL
124TPL, INS
124TPL, INS, PROG
124TPL, INS, PROG, INS


Desired Output:

ProcessIDJOBOPS
123INS, PROG, QA
124TPL, INS, PROG, INS

Accepted Solutions (1)

Accepted Solutions (1)

ido_millet
Active Contributor
0 Kudos

Insert a group on ProcessID. Create a formula that simply displays the variable in the Group Footer.

Hide the detail section.

Reset the variable in a group header formula (though it looks like you are already doing a proper reset).

scott_selph
Participant
0 Kudos

Thank you for the reply.  That did give me the part of the output I was looking for.  However, if the JobOps has blank/empty values it appears as if the ProcessID is then being suppressed and not reported.  Any suggestions on how to correct this?

Thanks!

abhilash_kumar
Active Contributor
0 Kudos

Change the LOAD formula to:

Shared numberVar x;

Shared stringVar array JobOps;

If {JobOperations.jmoProcessID} <> '' then

(

     x := x+1;

     redim preserve JobOps[x];

     JobOps [x] := {JobOperations.jmoProcessID};              

);

'';

Also, the drop-down on the top (inside this same formula field) that reads 'Exceptions for Nulls', change it to 'Default Values for Nulls'.

-Abhilash

scott_selph
Participant
0 Kudos

Thanks for the reply.  I changed the LOAD formula to the above and changed to 'Default Values for Nulls'.

Having done this, my report is still suppressing null values in the jmoProcessID field that are captured in the array.  I have checked my filtering, etc. and don't see anywhere I am excluding nulls.

Any suggestions on where to start trouble shooting?

Thanks!

abhilash_kumar
Active Contributor
0 Kudos

I might have misunderstood what you meant by 'suppressed records'.

Do you have an example please?

I also noticed that the array accumulates the {JobOperations.jmoProcessID} field, shouldn't it be accumulating the JobOps field instead?

-Abhilash

scott_selph
Participant
0 Kudos

Regarding "suppressed records", I was trying to state that it was not printing the records with null values.

Design view:

Preview: (Note the 7th column is where there are null values that are not printing)

Table Links:

Answers (0)