Focal Point
selection

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/1371098331

September 13, 2005, 07:13 AM
<user198>
selection
Hello,

i have a problem with a selection. I want to pass a parameter (team=...) in a hyperlink and in my fex should make this selection and write it into my graph selection. If I want to pass one parameter for the team, the team is not shown and it says: "Value for Team1 is missing". If I want to pass multiple parameters, the first team is always missing. This is why I wrote the clause -SET &Team= '&Team1.EVAL'; but it always says that the Value for the Team1 is missing.


DEFINE FILE wg_kd_betreuung
-SET &T= ' ';
-SET &Team= '&Team1.EVAL';
-SET &COUNTER=1;
-IF &Team0.EXISTS NE 1000 THEN GOTO LOOP1 ELSE GOTO DONE;
-LOOP1
-SET &T = 'AND ((TEAM EQ ''&Team.EVAL'')';
-IF &Team0.EXISTS NE 1 THEN GOTO OUTLOOP;
-REPEAT OUTLOOP FOR &COUNTER FROM 2 TO &Team0;
-SET &TEAMNEU= &Team.&COUNTER;
-SET &T = &T | ' OR (TEAM EQ ''&TEAMNEU.EVAL'')';
-OUTLOOP
-SET &T = &T | ')';
-DONE
END

What can I do that the first team is also shown? Please help me.

Katy
September 13, 2005, 08:26 AM
Tony A
Katy,

When you pass only one parameter from your selection HTML WebFOCUS only passes the Variable (in this case) &Team.

When you pass mulitple values then WebFOCUS will pass -

&Team - The first value selected
&Team0 - The number of values being passed
&Team1 - The first value selected (same as &Team!)
&Team2 - The second value selected
etc.

The way I would code for this (not necessarily the best method Smiler ) using your supplied code is -

-SET &T = 'AND ((TEAM EQ ''&Team.EVAL'')';
-IF &Team0.EXISTS NE 1 THEN GOTO OUTLOOP;
-REPEAT OUTLOOP FOR &COUNTER FROM 2 TO &Team0;
-SET &TEAMNEU= &Team.&COUNTER;
-SET &T = &T | ' OR (TEAM EQ ''&TEAMNEU.EVAL'')';
-OUTLOOP
-SET &T = &T | ')';
-DONE

Although as I mentioned in my PM I would prefer to use the CONTAINS verb rather than multiple ORs -

-SET &T = '(''&Team.EVAL''';
-IF &Team0.EXISTS NE 1 THEN GOTO OUTLOOP1;
-REPEAT OUTLOOP1 FOR &COUNTER FROM 2 TO &Team0;
-SET &TEAMNEU= &Team.&COUNTER;
-SET &T = &T | ',''&TEAMNEU.EVAL''';
-OUTLOOP1
-SET &T = &T | ')';
-DONE

And then in your Fex you would add the WHERE clause -

WHERE &T.EVAL CONTAINS TEAM

Even if there is only one value selected, the WHERE clause will still function correctly.

I have tested both of these using default values of -

-DEFAULT &Team = 'Team 1';
-DEFAULT &Team0 = 5;
-DEFAULT &Team1 = 'Team 1';
-DEFAULT &Team2 = 'Team 2';
-DEFAULT &Team3 = 'Team 3';
-DEFAULT &Team4 = 'Team 4';
-DEFAULT &Team5 = 'Team 5';

and the first method produces -

AND ((TEAM EQ 'Team 1') OR (TEAM EQ 'Team 2') OR (TEAM EQ 'Team 3')
OR (TEAM EQ 'Team 4') OR (TEAM EQ 'Team 5'))

whereas the second method produces -

WHERE ('Team 1','Team 2','Team 3','Team 4','Team 5') CONTAINS TEAM

If you remove the default for &Team0 (to simulate one selection) then you get -

AND ((TEAM EQ 'Team 1'))

or

WHERE ('Team 1') CONTAINS TEAM

respectively, both of which are valid syntax.

Good luck

Tony
September 13, 2005, 12:42 PM
suzy_smith
With release 5.2.5 on unix, there was a bug. IBI CSS cases 91341130 and 91751019 document this.

This was my question to IBI CSS:

I have entered the code on pages 8-20 through 8-24 of WebFOCUS Developing Reporting Applications. I substituted CAR for SHORT, and SEATS for PROJECTED_RETURN in mulrpt.fex.

The "application" runs correctly if you make multiple selections, but fails if you make a single selection.

Is the code in the example correct?


The workaround suggested to us was this:

When only 1 selection is made from the list, &COUNTRY0 is not passed in the URL string. Therefore, the IF &COUNTRY0.EXISTS will blow up.

To get around it, use -DEFAULTS &COUNTRY0=99; If it is passed in the URL, then its value will be re-set, otherwise, it will remain at 99. So you can test for 99 and branch based on that.


HTH, Suzy
September 13, 2005, 01:34 PM
Leah
I agree, when we went to the 5.x version of WebFOCUS, the Java interpreter no longer seems to recognize 'amper' variables embedded as part of a field name. For example, I had 8020&D in code that ran fine and dandy now when run no prompt, but the error shows up as no value supplied for &D. I had reported something regarding to IB but no fix ever came. I haven't tried in the 7. world yet.
September 13, 2005, 02:40 PM
Tony A
I have always recommended to my Clients that they -DEFAULT those variables that are not specifically -SET, even in drill down reports, to avoid situations like these.

As we have all encountered over the years (some for many years Frowner ) there is always an element of code tightening (whether intended or otherwise) and we will get caught out on an upgrade.

How many still use -SET &ECHO=ALL; without the single quotes around ALL? You can guarantee that this loop hole will be 'fixed' at some stage.
September 13, 2005, 11:54 PM
j.gross
quote:
Originally posted by Tony Alsford:
[qb] . . .
How many still use -SET &ECHO=ALL; without the single quotes around ALL? You can guarantee that this loop hole will be 'fixed' at some stage. [/qb]
No hole there.

In -SET: -SET FOO=BAR;
or TABLE: IF FOO NE BAR

BAR in the RHS cannot be mistaken for a variable, so the quotes are optional.

As opposed to (DEFINE or COMPUTE)
MyDate/MDY = &MDY; (or 091305Wink

where the RHS could represent either an offset, or a date literal. -- That's ambiguous, and Focus seems to try both, giving preference to the date if it's valid. I play safe and quote the date.