Joined: 23 Dec 2008
Online Status: Offline
Posts: 76
Topic: Record Selection Formula - Global Var Posted: 07 Apr 2009 at 2:12am
I want to use a shared variable in the Record Selection formula of a sub report. I can't use shared in the formula so I use a global.
I'm having trouble though as the global var is not set at the time when the record selection formula is evaluated ( I think ).
So, my questions are is this possible? Where should I set the global variable value so that it can be used in the selection formula
TIA
DC
REPORT HEADER b - Suppression Code Shared StringVar ShowMarketType; Global StringVar gShowMarketType; gShowMarketType := ShowMarketType; false;
SELCTION FORMULA Global StringVar gShowMarketType;
if gShowMarketType = 'A' then ( {RPT_COMMON_ORDER_CHRG.REPORT_PROCESS_ID} = {?Pm-RPT_COMMON_ORDER_HEADER.REPORT_PROCESS_ID} AND {RPT_COMMON_ORDER_CHRG.ORDER_ID} = {?Pm-RPT_COMMON_ORDER_HEADER.ORDER_ID} ) else //Restrict by Market Type code if not 'A'll. ( {RPT_COMMON_ORDER_CHRG.REPORT_PROCESS_ID} = {?Pm-RPT_COMMON_ORDER_HEADER.REPORT_PROCESS_ID} AND {RPT_COMMON_ORDER_CHRG.ORDER_ID} = {?Pm-RPT_COMMON_ORDER_HEADER.ORDER_ID} AND {RPT_COMMON_ORDER_CHRG.MARKET_TYPE_CODE} = gShowMarketType; )
Joined: 10 Mar 2008
Location: United States
Online Status: Offline
Posts: 4
Posted: 08 Apr 2009 at 9:32am
You cannot pass a global variable directly to a subreport. You need to use a shared variable to pass between main and sub reports (as far as i know).
But I know a workaround. You can create a formula in the main report @ShowMarketType and just declare the variable you want. In your case just this line:
Global StringVar gShowMarketType;
Now go to the Subreport links and pass this formula to the subreport as a parameter. After that you can use that subreport parameter in the record selection of the subreport.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum