Focal Point
[SOLVED] Trying to get filter selection logic right in DM:

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

September 02, 2015, 02:47 PM
CoolGuy
[SOLVED] Trying to get filter selection logic right in DM:
Hey all,

I've got an HTML form that passes values for a hierarchy of filtering options the user has to choose from. These are:

Division
District
Banner
Store
Department

I need some help wrapping my head around how to write some DM (dialog manager) logic that would run a report with certain params depending on which filters are selected.

So, what I need is: if the user has selected a division value to pass it will run the report with the division params; if the user has selected a division and a district value thereafter, it will run the report with district params. Or if the user has a district selected but not a division it will run the district params against the report anyways. This is the kind of logic I need to replicate for the whole chain of filters.

I'm going to continue to poke at it and see if I can figure it out, but if any of you can think of the logic before me, I would greatly appreciate the help.

Here's what I got so far (Note: The &HIDDEN variable is to let the content know the filters have been passed (if you're curious)):

-IF (&HIDDEN EQ 'Y') AND (&DSDIVISION NE _FOC_NULL) THEN GOTO DivRptSets ELSE
-IF (&HIDDEN EQ 'Y') AND (&DSDISTRICT NE _FOC_NULL) THEN GOTO DistRptSets ELSE
-IF (&HIDDEN EQ 'Y') AND (&DSBANNERGL NE _FOC_NULL) THEN GOTO BannRptSets ELSE
-IF (&HIDDEN EQ 'Y') AND (&DSACCTNO NE _FOC_NULL) THEN GOTO StrRptSets ELSE
-IF (&HIDDEN EQ 'Y') AND (&DDDEPTCODE NE _FOC_NULL) THEN GOTO DeptRptSets ELSE GOTO DivRptSets;

...

-DivRptSets

-SET &DSDIVISION = IF &DSDIVISION EQ _FOC_NULL THEN '99' ELSE &DSDIVISION;
-SET &forName = 'for division &DSDIVISION.EVAL';
-SET &select = 'WHERE ( SRPROD.DIMSTORE.DSDIVISION EQ &DSDIVISION.(FIND SRPROD.DIMSTORE.DSDIVISION IN SRPROD).Div #:. );';

-GOTO Rpt;

...

-Rpt
TABLE FILE ...


Will post back if I figure it out myself.

Thanks in advance!

This message has been edited. Last edited by: CoolGuy,


8.2.02M (production), 8.2.02M (test), Windows 10, all outputs.
September 02, 2015, 03:30 PM
CoolGuy
Well everyone, I figured it out.

Here's the working logic:

-IF (&HIDDEN EQ 'Y') AND (&DSDIVISION NE _FOC_NULL) AND (&DSDISTRICT NE _FOC_NULL)  AND (&DSBANNERGL NE _FOC_NULL) AND (&DSACCTNO NE _FOC_NULL) AND (&DDDEPTCODE NE _FOC_NULL) OR (&DDDEPTCODE NE _FOC_NULL) THEN GOTO DeptRptSets ELSE
-IF (&HIDDEN EQ 'Y') AND (&DSDIVISION NE _FOC_NULL) AND (&DSDISTRICT NE _FOC_NULL)  AND (&DSBANNERGL NE _FOC_NULL) AND (&DSACCTNO NE _FOC_NULL) AND (&DDDEPTCODE EQ _FOC_NULL) OR (&DSACCTNO NE _FOC_NULL) THEN GOTO StrRptSets ELSE
-IF (&HIDDEN EQ 'Y') AND (&DSDIVISION NE _FOC_NULL) AND (&DSDISTRICT NE _FOC_NULL)  AND (&DSBANNERGL NE _FOC_NULL) AND (&DSACCTNO EQ _FOC_NULL) AND (&DDDEPTCODE EQ _FOC_NULL) OR (&DSBANNERGL NE _FOC_NULL) THEN GOTO BannRptSets ELSE
-IF (&HIDDEN EQ 'Y') AND (&DSDIVISION NE _FOC_NULL) AND (&DSDISTRICT NE _FOC_NULL)  AND (&DSBANNERGL EQ _FOC_NULL) AND (&DSACCTNO EQ _FOC_NULL) AND (&DDDEPTCODE EQ _FOC_NULL) OR (&DSDISTRICT NE _FOC_NULL) THEN GOTO DistRptSets ELSE
-IF (&HIDDEN EQ 'Y') AND (&DSDIVISION NE _FOC_NULL) AND (&DSDISTRICT EQ _FOC_NULL)  AND (&DSBANNERGL EQ _FOC_NULL) AND (&DSACCTNO EQ _FOC_NULL) AND (&DDDEPTCODE EQ _FOC_NULL) OR (&DSDIVISION NE _FOC_NULL) THEN GOTO DivRptSets ELSE GOTO DivRptSets;


Hope this comes in handy for someone down the road working with "magic/global" filters within the BI portal.

Take care!


8.2.02M (production), 8.2.02M (test), Windows 10, all outputs.