Focal Point
multiple selection in a drill-down list

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

September 08, 2005, 10:41 AM
<user198>
multiple selection in a drill-down list
Hello,

i have a problem with the handing over of variables. My code is the following:

DEFINE FILE wg_kd_betreuung
OPTOrt/A40 = '<option>'|ORT|'</option>';
END
TABLE FILE wg_kd_betreuung
SUM OPTOrt
BY ORT NOPRINT
ON TABLE HOLD FORMAT ALPHA AS DYNAMLST
END

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

On my page you can see the drill-down list with all teams out of the table "kd_betreuung" but if you want to select more than one team, you can see in the URL that the Teams are included but in the graphic they are not shown, espacially there is no graphic shown because the teams are not committed.

In the source code it is said:

TABLE FILE wg_kd_betreuung
-SET &COUNTER=1;
-SET &T=' ';
-IF 1 THEN GOTO LOOP1 ELSE GOTO DONE;
-LOOP1
-SET &T = 'AND (TEAM EQ ''HAM WG3/M'')';
-IF 1 NE 1 THEN GOTO OUTLOOP;
-REPEAT OUTLOOP FOR COUNTER FROM 2 TO 2;
-SET &T = AND (TEAM EQ '&Team') | 'AND (TEAM EQ ''HAM WG3/P'')';
-REPEAT OUTLOOP FOR COUNTER FROM 2 TO 2;
-OUTLOOP
-DONE
END

and in the definition of the graphic stands:

GRAPH FILE WG_VIEW_KD_PERFORMANCE
SUM WG_VIEW_KD_PERFORMANCE.UC09AUNS AS 'COUNT'
ACROSS myDATUM AS 'DATE'
BY TEAM AS 'TEAM'
WHERE (myDATUM GE TStart) AND (myDATUM LE TStart )
AND (TEAM EQ '&Team')AND (TEAM EQ '&Team2');

I do not know why in the last phrase stands " AND (TEAM EQ '&Team')AND (TEAM EQ '&Team2');" because there should be the names of the teams, or not? Perhaps I have made a mistake in the whole part.

I hope you can help me out and thanks a lot!
Smiler
Katy
September 08, 2005, 01:54 PM
Tony A
Katy,

You show the actual code from your report but not from the GRAPH FILE. I guess that the DM for the building of the WHERE clause is achieved outside of your TABLE request? That being the case I also guess that you have the code -

WHERE (myDATUM GE TStart) AND (myDATUM LE TStart )
&T;

in your GRAPH FILE request?

If this is the case then I would hazard a guess that the &T in your GRAPH FILE is not being fully evaluated so changing it to &T.EVAL may be the solution.

If that doesn't work then post your code in full (if you can, or PM it) and we'll try to assist further.
September 08, 2005, 02:41 PM
susannah
make sure there's a space before the AND in your &T; in your example, there isn't; maybe that's just a repro-typo.
oh yes...good catch, Francis.
September 08, 2005, 02:51 PM
Francis Mariani
AND (TEAM EQ '&Team')AND (TEAM EQ '&Team2');

TEAM cannot be equal to both values.

AND (TEAM EQ '&Team') OR (TEAM EQ '&Team2');
September 09, 2005, 12:08 PM
Tony A
Katy,

In additon to the PM I sent you, I thought that I would give you an example of the suggestion -

-SET &Team = 'ENGLAND';
-SET &Team0 = 3;
-SET &Team1 = 'ENGLAND';
-SET &Team2 = 'FRANCE';
-SET &Team3 = 'JAPAN';

-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

TABLE FILE CAR
SUM RCOST DCOST
BY COUNTRY
BY CAR
BY MODEL
WHERE RCOST GE 3200 AND RCOST LE 8000
WHERE COUNTRY IN &T
END

The WHERE COUNTRY could be replaced with AND COUNTRY but they both would imply the same condition.

You should get only three records out as one car from Japan is less than 3200 and all but one car from England are greater than 8000.

As I said, I sometimes prefer using CONTAINS (or IN) rather than multiple ORs.

Good luck

Tony
September 16, 2005, 06:05 AM
<user198>
Hello everyone,

thanks for your help! All works...

Katy

This is my code:

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

...

WHERE ((myDATUM GE &S) AND (myDATUM LE &E))
&T.EVAL;