I have a Main/Sub report task that I'm trying to modify.
The report is a sales call tracking report and the sub report gathers time off territory from the database which is used in calculating a calls per day average.
This subreport fires from the main report header one time and collects into a series of shared array variables that are accessed by the main report. This is working just fine. The array build code from the subreport looks as follows:
Requirements have changed and I need to move the report to a group header which I know will fire it more frequently. This is necessary to be able to gather period data for date ranges greater than 1 month and include another grouping by month. Simply moving the subreport to the group header as is continued to extend the array for each successive execution resulting in the incorrect values being returned to the main report.
I’m attempting to reinitialize the array prior to execution and created a formula to be put into the subreport header that looks like the following:
Now when I perform a syntax check in the formula editor I receive, on any of the ReDim statements, the following error:
“The result of a formula cannot be an array”
I’m puzzled why that syntax works when I’m dynamically expanding the array but not when I want to re-initialize it. I’m open to any other suggestions or techniques to re-initialize the array to empty, erase or delete the previous variables so that they can be fresh with each execution of the subreport yet still be shared for access to the main report.
The report is a sales call tracking report and the sub report gathers time off territory from the database which is used in calculating a calls per day average.
This subreport fires from the main report header one time and collects into a series of shared array variables that are accessed by the main report. This is working just fine. The array build code from the subreport looks as follows:
Code:
shared stringVar Array ArrOffTerritoryUser;
shared datevar array ArrOffTerritoryDate;
shared numbervar array ArrOffTerritoryCnt;
Redim Preserve ArrOffTerritoryUser[UBound(ArrOffTerritoryUser) + 1];
ArrOffTerritoryUser[UBound(ArrOffTerritoryUser)] := GroupName ({MCG_OFFTERRITORY.USERID});
Redim Preserve ArrOffTerritoryCnt[UBound(ArrOffTerritoryCnt) + 1];
ArrOffTerritoryCnt[UBound(ArrOffTerritoryCnt)] := Count ({MCG_OFFTERRITORY.OFFTERRITORYDATE}, {MCG_OFFTERRITORY.USERID});
Redim Preserve ArrOffTerritoryDate[UBound(ArrOffTerritoryDate) + 1];
ArrOffTerritoryDate[UBound(ArrOffTerritoryDate)] := date({MCG_OFFTERRITORY.OFFTERRITORYDATE});
Requirements have changed and I need to move the report to a group header which I know will fire it more frequently. This is necessary to be able to gather period data for date ranges greater than 1 month and include another grouping by month. Simply moving the subreport to the group header as is continued to extend the array for each successive execution resulting in the incorrect values being returned to the main report.
I’m attempting to reinitialize the array prior to execution and created a formula to be put into the subreport header that looks like the following:
Code:
shared stringVar Array ArrOffTerritoryUser;
shared datevar array ArrOffTerritoryDate;
shared numbervar array ArrOffTerritoryCnt;
Redim ArrOffTerritoryUser[0];
Redim ArrOffTerritoryCnt[0];
Redim ArrOffTerritoryDate[0];
Now when I perform a syntax check in the formula editor I receive, on any of the ReDim statements, the following error:
“The result of a formula cannot be an array”
I’m puzzled why that syntax works when I’m dynamically expanding the array but not when I want to re-initialize it. I’m open to any other suggestions or techniques to re-initialize the array to empty, erase or delete the previous variables so that they can be fresh with each execution of the subreport yet still be shared for access to the main report.