on ‎2022 Mar 10 5:31 PM
I have two arrays that I am building in my report -- one with a description and one with an associated running total for that description. As I read each record, I am looking to see if the description already exists in the array. If so, the associated running total is incremented. If not, a new array element is added for each array containing the new info:
Shared NumberVar Array PkgBal;
Shared StringVar Array PkgDesc;
NumberVar i;
BooleanVar FoundIt := NO;
For i := 1 to UBound(PkgBal) Do
(
If PkgDesc[i] = Packaging-Code THEN
(
PkgBal[i] := PkgBal[i] + Balance;
FoundIt := YES;
Exit For
);
);
If FoundIt = NO THEN
(
i := Ubound(PkgBal) + 1;
Redim Preserve PkgBal[i];
Redim Preserve PkgDesc[i];
PkgBal[i] := Balance;
PkgDesc[i] :=Packaging-Code
);
In the report footer, I want to print a table of the value of the arrays:
Desc 1 Total 1
Desc 2 Total 2
etc.
Is there a way to do it without creating a Report Footer section for each possible array element (could be 100+) and creating an associated formula for each element (e.g. Desc-1 = PkgDesc[1], Desc-2 = PkgDesc[2], etc)?
Request clarification before answering.
Yes, convert to string using ToText() function.
The reason I would advise against doing an implicit conversion using the & operator is that implicit conversion might leave you with undesired decimals and thousand separators.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Option 1, use newLine character(s).
Option 2: do the whole thing by simply inserting a CrossTab.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 5 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.