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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use shared variable from formula in Record selection

Status
Not open for further replies.

huytonscouser

Programmer
Oct 14, 2011
88
US
Record selection has this :-



{SRMARRAY.ARRAYALIAS} startswith ["ROM", "UKA", "UKB", "UKP", "UKS"] and
{@Hours DIFF} and
{SRMARRAY.ISCURRENT} = "Y"

I have a Formula called INITSTUFF in the Report header :-


shared numbervar gmtoffset ;
shared STRINGVAR array arraynames ;
Select {?Site Name}



Case "Brighton":
(
arraynames := ["ROM", "UKA", "UKB", "UKP", "UKS"];
gmtoffset := 0;
)


Default:
(
arraynames := ["any"];
gmtoffset := 0 ;
)
;

How can i change the record selection formula to use the
arraynames in the CASE statement for startswith ?
 
If its as simple as you show change receord selection to

(If {?Site Name} = 'Brighton' then {SRMARRAY.ARRAYALIAS} startswith ["ROM", "UKA", "UKB", "UKP", "UKS"] else true) and
{@Hours DIFF} and
{SRMARRAY.ISCURRENT} = "Y"

 
Ian, sorry you bother you.

I'd like the Record selection to use the arraynames data and variable set up in the INITSTUFF formula.

Initstuff formula :-

shared numbervar gmtoffset ;
shared STRINGVAR array arraynames ;
Select {?Site Name}

Case "Phoenix":
(
arraynames := ["PHX", "IDN", "HQH"];
gmtoffset := -8;
)

Case "Minneapolis":
(
arraynames := ["FTL", "GRN", "MKH", "MSP", "NYC", "SLC"];
gmtoffset := -5;
)

Case "Greensboro":
gmtoffset := -5

Case "Brighton":
(
arraynames := ["ROM", "UKA", "UKB", "UKP", "UKS"];
gmtoffset := 0;
)

Case "India Cyber City":
(
arraynames := ["CYB"];
gmtoffset := 5.5;
)

Case "India NCR":
(
arraynames := ["CYB", "FCG", "NCR"];
gmtoffset := 5.5;
)

Case "Singapore":
(
arraynames := ["SIN"];
gmtoffset := 8;
)

Case "Sydney":
(
arraynames := ["SYD"];
gmtoffset := 10;
)
Default:
(
arraynames := ["any"];
gmtoffset := 0 ;
)
;
 
I'm not entirely sure whether this will work, but try creating a new formula that I'll call {@ArrayNames}:

shared STRINGVAR array arraynames ;
arraynames

Use this formula in your selection criteria.

-Dell

DecisionFirst Technologies - Six-time SAP BusinessObjects Solution Partner of the Year
 
Why are you using shared variables? You can't use shared variables in a selection formula.

If there is no subreport involved, just remove the "shared" from the formula and then it will work in the record selection formula.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top