on 01-08-2015 3:20 PM
Hi everyone,
I have a certain group in the main report. For each item in that group i want to store a corresponding value in the array.
In the sub report which is placed in the main report there may or may not be items in a group that match with items in the main report.
For example let items A,B and C are in the main report and have values.
If item B doesn't exist in the sub report,ignore the value at index 2 of the array and assign the value at index 3 to item C.
Is it possible to do that?
Thank you
Hi Nebil,
Here's what you need to do :
1) In the existing formula on the Main Report, introduce another string array (alongside the number array that you already have) to store the group name at the same position. E.g:
WhilePrintingRecords;
shared stringvar array items;
shared numbervar array values;
numbervar x := x + 1;
redim preserve items[x] //this stores the group's name;
redim preserve values[x] //this stores the value for that particular group;
items[x] := {Group_Name};
values[x] := {@total} //your total formula;
"";
2) Inside the Subreport, create a formula with this code:
WhilePrintingRecords;
shared stringVar array items;
shared numbervar array values;
numbervar i;
If {Group_Name} IN items then
(
for i := 1 to ubound(items) do
(
if items[i] = {Group_Name} then
(
numbervar v := values[i];
exit for;
);
);
);
v;
Hope this helps.
-Abhilash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.