I'm using Crystal Report 10 and have created a parameter called {?SalesMonths}. This parameter allows the user to select from 1 to 12 months.
The attached code is for the formula {@DispMonth} that is not working. This formula is to display the name of the months selected (monthname) is Crystal Report function. The formula throws no errors when being compiled but when run the lengh of the array is causing a problem. Using 12 as the number of elements in the array is only correct if all 12 months are selected.
I'm not sure how to get the array length or number of elements in the array. Using {?SalemsMonths}.length does not compile. If I select only 3 months and hard code {?SalesMonths}(3) the code runs but nothing is displayed.
I assume this means the For Next loop either does not run or is not collecting data. Not sure if the "monthname" is causing the problem or not.
HELP!!!! I'm stumbling on creating and using a simple one dementional array.
Code:
Global SalesMonths({?SalesMonths}(12)) as number
Global DispMonth as string
Global i as number
DispMonth=""
for i=salesmonths(1) to salesmonths(12) step 1
if i >0 then
DispMonth=DispMonth & ", " & monthname(i)
end if
next i
formula=DispMonth
The attached code is for the formula {@DispMonth} that is not working. This formula is to display the name of the months selected (monthname) is Crystal Report function. The formula throws no errors when being compiled but when run the lengh of the array is causing a problem. Using 12 as the number of elements in the array is only correct if all 12 months are selected.
I'm not sure how to get the array length or number of elements in the array. Using {?SalemsMonths}.length does not compile. If I select only 3 months and hard code {?SalesMonths}(3) the code runs but nothing is displayed.
I assume this means the For Next loop either does not run or is not collecting data. Not sure if the "monthname" is causing the problem or not.
HELP!!!! I'm stumbling on creating and using a simple one dementional array.
Code:
Global SalesMonths({?SalesMonths}(12)) as number
Global DispMonth as string
Global i as number
DispMonth=""
for i=salesmonths(1) to salesmonths(12) step 1
if i >0 then
DispMonth=DispMonth & ", " & monthname(i)
end if
next i
formula=DispMonth