So I've been tasked with updating a custom report created by a customer to make it more generic for use by all other customers. The report shows total sales based on payment method, and it combines all of the different credit cards (which are stored internally in our software as separate payment methods) into one "Credit Cards" group. Unfortunately, these values are hard-coded in the report. I created the following formulas in a subreport to generate an array of the valid credit card names pulled from the database so any customer can use it:
//Init
Shared StringVar Array CreditCards;
ReDim CreditCards[1];
//Calc (in the details section)
Shared StringVar Array CreditCards;
CreditCards[ubound(CreditCards)] := {CreditCard.crCard};
ReDim Preserve CreditCards[ubound(CreditCards)+1];
//Display (suppressed, used to check if I got all the cards)
Shared StringVar Array CreditCards;
Join(CreditCards, chr(10));
Then, I figured I'd just do this in my group formula, where Sales_ByPayMethod is a stored procedure...
Shared StringVar Array CreditCards;
If {Sales_ByPayMethod;1.finPayMethod} In CreditCards Then 'Credit Card'
...only to find out that this doesn't work because you apparently can't use a shared variable in a grouping formula. Is there a workaround for this? Or (preferably) the right way to do it? I'm forced into using Crystal 8.5 (I know) so I'm hoping the answer isn't upgrade...