Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Load Column Names based on Array

Status
Not open for further replies.

mgallot

MIS
Jan 22, 2001
93
0
0
US
Using CRXI, I have an array that is initialized in the report header called Valid Columns Array.
//init
whileprintingrecords;
shared numbervar array colHdrValid:=[0,0,0,0,0,0,0,0,0,0
,0,0,0,0,0,0,0,0,0,0,0];
true

The array is to check on valid Market Groups as Column Headings going horizontally and using 3 subreports so that 21 columns can be displayed.

//
whileprintingrecords;

shared numbervar array colHdrValid;
stringvar dispText:="";
numbervar i;

for i:=1 to 21 do
(
dispText:=dispText & totext(colHdrValid, 0, "")
);
"Valid array vals: " & dispText

The array is successfully checking the valid records, but the load into the column headings is not happening correctly.

//Column header 2
if {?ChooseSort} = 'm' and count({?MarketGroup}) >= 1 and not(trim({?MarketGroup}[1]) = "All Market Groups")
and colHdrValid[currentColumn+1]=1
then (
Col2_Hdr := {?MarketGroup}[currentColumn];
currentColumn:=currentColumn+1);
if {?ChooseSort} = 'm' and count({?MarketGroup}) >= 1 and not(trim({?MarketGroup}[1]) = "All Market Groups")
and colHdrValid[currentColumn+1]=0
then // find the next valid market group
( for i:=(currentColumn+1) to 21 do
if colHdrValid=1 then
(Col2_Hdr := {?MarketGroup}[i-1];
currentColumn:=i;
exit for
)
);

//Column header 3
if {?ChooseSort} = 'm' and count({?MarketGroup}) >= 2 and not(trim({?MarketGroup}[1]) = "All Market Groups")
and colHdrValid[currentColumn+1]=1
then (
Col3_Hdr := {?MarketGroup}[currentColumn];
currentColumn:=currentColumn+1);
if {?ChooseSort} = 'm' and count({?MarketGroup}) >= 2 and not(trim({?MarketGroup}[1]) = "All Market Groups")
and colHdrValid[currentColumn+1]=0
then // find the next valid market group
( for i:=(currentColumn+1) to 21 do
if colHdrValid=1 then
(Col3_Hdr := {?MarketGroup}[i-1];
currentColumn:=i;
exit for
)
);
//Column header 4
if {?ChooseSort} = 'm' and count({?MarketGroup}) >= 3 and not(trim({?MarketGroup}[1]) = "All Market Groups")
and colHdrValid[currentColumn+1]=1
then (
Col4_Hdr := {?MarketGroup}[currentColumn];
currentColumn:=currentColumn+1);
if {?ChooseSort} = 'm' and count({?MarketGroup}) >= 3 and not(trim({?MarketGroup}[1]) = "All Market Groups")
and colHdrValid[currentColumn+1]=0
then // find the next valid market group
( for i:=(currentColumn+1) to 21 do
if colHdrValid=1 then
(Col4_Hdr := {?MarketGroup}[i-1];
currentColumn:=i;
exit for
)
);
This happens for all columns.

This is abbreviated but output is like this:
Total Boston Business Risk Chicago Dallas

Personnel 1,256,336 (101,917) 0 139,324 99,000 Planned Adj 1,442,534 (466,350) 0 (99,749) 8,991

It should not show Business Risk or any column with all zeros. The records are being excluded in the record selection, but show up because the manual crosstab is forcing all columns to stay in place, and the headings arent being correctly loaded from the parameter. Any help is appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top