cancel
Showing results for 
Search instead for 
Did you mean: 

Populating an array of strings

Former Member
0 Kudos

I'm sorry if this is elementary, but I'm having a surprisingly difficult time finding helpful articles about this.

My report is grouped something like this:

Branch

Item

For each branch, I need to determine whether or not a specific item has had an itemCode assigned to it. Each department has this item, but not all of them have an itemCode assigned to it. If not, a message needs to be displayed in the footer of the Branch section.

My idea is to have a suppressed section in the Item group that checks to see if it has the itemCode assigned. If not, a message would be added to an array and the array would display in the Branch footer. For the next Branch, the array would have to be reset again.

How is this handled in Crystal Reports XI?

Thanks.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Abhilash,

Yes, that's basically what I'm looking for.

abhilash_kumar
Active Contributor
0 Kudos

Well, you really do not need an array for this. A simple string variable with values separated by commas would be just fine.

Alright, so here's what you need to do:

1) Create a formula called 'accum' and place this on the details section that shows the Item Codes:

whileprintingrecords;
stringvar items;
if {Item_code} = "" or isnull(Item_code) then
items := items + totext({Item_No},0) + ",";

2) Create another formula called 'disp' and place this on the Branch's Group Footer:

whileprintingrecords;
stringvar items;
{Branch} + " has these Items that do not have an Item Code: " + items;

3) Finally, a formula to reset the variables. Place this on the Group Header (Branch):

whileprintingrecords;
stringvar items = "";

Let me know how this goes!

-Abhilash

Former Member
0 Kudos

Abhilash

Thanks! I think this will do the trick.

abhilash_kumar
Active Contributor
0 Kudos

Hi,

Do you mean to say you wish to have the array populated with all the Items that do not have an associated ItemCode?

For eg: Every Branch's footer would have something like:

"The following Items do not have an Items Code : Item 1, Item 3, item 6,..."

Please correct me if I've understood this corerctly. Once I have a confirmation I send you the steps.

-Abhilash