Hello all. I've been working on this one for a couple days off and on and am stumped to say the least. I am creating a report that has two groups. The first one is on a specific client then on the individual contracts for each client. My problem lies in that the detail info come duplicated due to there being multiple agents for the one contract. As you might guess they don't want the information duplicated to show all the agents, but instead would like them listed horizontally at the end of each contract. So I moved the detail to the contract to the group header of the contract and am trying to collect the agents into an array that I can work with in the group footer. I keep getting the error that the subscript must be between 1 and the max for the array. Alsot they have said that there will be a max of 6 agents but that they may be duplicated a few times each. Another note is that some of my fomulas are boolean for some reason so I had to use the ToText function. Man I wish I knew more about crystal reports.
Here are the formulas that I am attempting:
In the detail:
//Formula @AgentsArray
//Put all the agents into an array
StringVar Array Agents[100];
NumberVar AgentNum;
AgentNum := AgentNum + 1;
Agents[AgentNum] := {ClientContractListingByAmount_ttx.AgentCode};
In the group footer:
//Formula @Agent1
StringVar Array Agents;
NumberVar AgentNum;
IF AgentNum > 0 Then
Agents[1];
//Formula @Agent2
EvaluateAfter ({@Agent1});
StringVar Array Agents;
NumberVar AgentNum;
Local NumberVar i;
For i := 1 to AgentNum Do
(
IF Agents <> {@Agent1} Then
(
Agents;
Exit For
)
);
//Formula @Agent3
EvaluateAfter ({@Agent2});
StringVar Array Agents;
NumberVar AgentNum;
Local NumberVar i;
For i := 1 to AgentNum Do
(
IF Agents <> {@Agent1} AND Agents <> ToText({@Agent2}) Then
(
Agents;
Exit For
)
);
//Formula @Agent4
EvaluateAfter ({@Agent3});
StringVar Array Agents;
NumberVar AgentNum;
Local NumberVar i;
For i := 1 to AgentNum Do
(
IF Agents <> {@Agent1} AND Agents <> ToText({@Agent2}) AND
Agents <> ToText({@Agent3}) Then
(
Agents;
Exit For
)
);
-----I would post the next two, but they are along the same lines with just updated IF to include a check for duplication. Sorry for such a big post but I'm dragging here and could use any aid anyone can send forth.
My thanx, [sig][/sig]
Here are the formulas that I am attempting:
In the detail:
//Formula @AgentsArray
//Put all the agents into an array
StringVar Array Agents[100];
NumberVar AgentNum;
AgentNum := AgentNum + 1;
Agents[AgentNum] := {ClientContractListingByAmount_ttx.AgentCode};
In the group footer:
//Formula @Agent1
StringVar Array Agents;
NumberVar AgentNum;
IF AgentNum > 0 Then
Agents[1];
//Formula @Agent2
EvaluateAfter ({@Agent1});
StringVar Array Agents;
NumberVar AgentNum;
Local NumberVar i;
For i := 1 to AgentNum Do
(
IF Agents <> {@Agent1} Then
(
Agents;
Exit For
)
);
//Formula @Agent3
EvaluateAfter ({@Agent2});
StringVar Array Agents;
NumberVar AgentNum;
Local NumberVar i;
For i := 1 to AgentNum Do
(
IF Agents <> {@Agent1} AND Agents <> ToText({@Agent2}) Then
(
Agents;
Exit For
)
);
//Formula @Agent4
EvaluateAfter ({@Agent3});
StringVar Array Agents;
NumberVar AgentNum;
Local NumberVar i;
For i := 1 to AgentNum Do
(
IF Agents <> {@Agent1} AND Agents <> ToText({@Agent2}) AND
Agents <> ToText({@Agent3}) Then
(
Agents;
Exit For
)
);
-----I would post the next two, but they are along the same lines with just updated IF to include a check for duplication. Sorry for such a big post but I'm dragging here and could use any aid anyone can send forth.
My thanx, [sig][/sig]