Skip to Content
author's profile photo Former Member
Former Member

Assign array values to items in a sub report

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Jan 09, 2015 at 05:13 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.