I am using an excel doc with multiple worksheets as a datasource. (Warned users that I couldn't promise anything, but I'd give it a try.)
The worksheets show up like tables in a database and the columns as fields in crystal. So far, so good.
I have set up a date parameter.
There are 12 of these pseudo-tables named JAN_, FEB_, MAR_, etc.
I need to be able to display data from one column in one worksheet - equivalent to one day's data when the report is run.
Is there some way to use the month and day from the date parameter to go to the right table and pull the right columns' data?
I have tried this, but I am getting an error that the {fieldname1} fieldname does not exist - is there some syntax that will get this last line to work?? Thanks!!
stringvar monthprefix;
stringvar daysuffix;
switch
(month({?BeginDate})=1, monthprefix:='JAN',
month({?BeginDate})=2, monthprefix:='FEB',
month({?BeginDate})=3, monthprefix:='MAR',
month({?BeginDate})=4, monthprefix:='APR',
month({?BeginDate})=5, monthprefix:='MAY',
month({?BeginDate})=6, monthprefix:='JUN',
month({?BeginDate})=7, monthprefix:='JUL',
month({?BeginDate})=8, monthprefix:='AUG',
month({?BeginDate})=9, monthprefix:='SEP',
month({?BeginDate})=10, monthprefix:='OCT',
month({?BeginDate})=11, monthprefix:='NOV',
month({?BeginDate})=12, monthprefix:='DEC');
switch(
day({?BeginDate})=1,daysuffix:='2',
day({?BeginDate})=2,daysuffix:='3',
day({?BeginDate})=3,daysuffix:='4',
day({?BeginDate})=4,daysuffix:='5',
day({?BeginDate})=5,daysuffix:='6',
day({?BeginDate})=6,daysuffix:='7',
day({?BeginDate})=7,daysuffix:='8',
day({?BeginDate})=8,daysuffix:='9',
day({?BeginDate})=9,daysuffix:='10',
day({?BeginDate})=10,daysuffix:='11',
day({?BeginDate})=11,daysuffix:='12',
day({?BeginDate})=12,daysuffix:='13',
day({?BeginDate})=13,daysuffix:='14',
day({?BeginDate})=14,daysuffix:='15',
day({?BeginDate})=15,daysuffix:='16',
day({?BeginDate})=16,daysuffix:='17',
day({?BeginDate})=17,daysuffix:='2',
day({?BeginDate})=18,daysuffix:='3',
day({?BeginDate})=19,daysuffix:='4',
day({?BeginDate})=20,daysuffix:='5',
day({?BeginDate})=21,daysuffix:='6',
day({?BeginDate})=22,daysuffix:='7',
day({?BeginDate})=23,daysuffix:='8',
day({?BeginDate})=24,daysuffix:='9',
day({?BeginDate})=25,daysuffix:='10',
day({?BeginDate})=26,daysuffix:='11',
day({?BeginDate})=27,daysuffix:='12',
day({?BeginDate})=28,daysuffix:='13',
day({?BeginDate})=29,daysuffix:='14',
day({?BeginDate})=30,daysuffix:='15',
day({?BeginDate})=31,daysuffix:='16'
);
shared numbervar array dayarray;
stringvar fieldname1;
fieldname1:=monthprefix+"_.F"+daysuffix;
redim preserve dayarray[recordnumber];
dayarray[recordnumber]:={fieldname1}
The worksheets show up like tables in a database and the columns as fields in crystal. So far, so good.
I have set up a date parameter.
There are 12 of these pseudo-tables named JAN_, FEB_, MAR_, etc.
I need to be able to display data from one column in one worksheet - equivalent to one day's data when the report is run.
Is there some way to use the month and day from the date parameter to go to the right table and pull the right columns' data?
I have tried this, but I am getting an error that the {fieldname1} fieldname does not exist - is there some syntax that will get this last line to work?? Thanks!!
stringvar monthprefix;
stringvar daysuffix;
switch
(month({?BeginDate})=1, monthprefix:='JAN',
month({?BeginDate})=2, monthprefix:='FEB',
month({?BeginDate})=3, monthprefix:='MAR',
month({?BeginDate})=4, monthprefix:='APR',
month({?BeginDate})=5, monthprefix:='MAY',
month({?BeginDate})=6, monthprefix:='JUN',
month({?BeginDate})=7, monthprefix:='JUL',
month({?BeginDate})=8, monthprefix:='AUG',
month({?BeginDate})=9, monthprefix:='SEP',
month({?BeginDate})=10, monthprefix:='OCT',
month({?BeginDate})=11, monthprefix:='NOV',
month({?BeginDate})=12, monthprefix:='DEC');
switch(
day({?BeginDate})=1,daysuffix:='2',
day({?BeginDate})=2,daysuffix:='3',
day({?BeginDate})=3,daysuffix:='4',
day({?BeginDate})=4,daysuffix:='5',
day({?BeginDate})=5,daysuffix:='6',
day({?BeginDate})=6,daysuffix:='7',
day({?BeginDate})=7,daysuffix:='8',
day({?BeginDate})=8,daysuffix:='9',
day({?BeginDate})=9,daysuffix:='10',
day({?BeginDate})=10,daysuffix:='11',
day({?BeginDate})=11,daysuffix:='12',
day({?BeginDate})=12,daysuffix:='13',
day({?BeginDate})=13,daysuffix:='14',
day({?BeginDate})=14,daysuffix:='15',
day({?BeginDate})=15,daysuffix:='16',
day({?BeginDate})=16,daysuffix:='17',
day({?BeginDate})=17,daysuffix:='2',
day({?BeginDate})=18,daysuffix:='3',
day({?BeginDate})=19,daysuffix:='4',
day({?BeginDate})=20,daysuffix:='5',
day({?BeginDate})=21,daysuffix:='6',
day({?BeginDate})=22,daysuffix:='7',
day({?BeginDate})=23,daysuffix:='8',
day({?BeginDate})=24,daysuffix:='9',
day({?BeginDate})=25,daysuffix:='10',
day({?BeginDate})=26,daysuffix:='11',
day({?BeginDate})=27,daysuffix:='12',
day({?BeginDate})=28,daysuffix:='13',
day({?BeginDate})=29,daysuffix:='14',
day({?BeginDate})=30,daysuffix:='15',
day({?BeginDate})=31,daysuffix:='16'
);
shared numbervar array dayarray;
stringvar fieldname1;
fieldname1:=monthprefix+"_.F"+daysuffix;
redim preserve dayarray[recordnumber];
dayarray[recordnumber]:={fieldname1}