Forum Discussion

Walter_Mangy's avatar
Walter_Mangy
New Member
1 year ago
Solved

Dynamic lineage filter: “Depth” parameter + up/down‑stream toggle keeps throwing “expects a table”

Data model Interaction mapping (fact) – two columns: Parent, Child Node (one‑column table) – list of every unique node; used as the starting‑point slicer Drilldown (numeric parameter 1→6) – how m...
  • johnt75's avatar
    1 year ago

    Its the same problem - SWITCH returns a scalar value and you're trying to return a table. I think you need to combine the SWITCH statement with the check for CONTAINS, e.g.

    VAR Result =
        SWITCH (
            SelectedDirection,
            "Use-cases focused",
                CONTAINS ( Upstream, [Node], CurParent )
                    && CONTAINS ( Upstream, [Node], CurChild ),
            "Data input focused",
                CONTAINS ( Downstream, [Node], CurParent )
                    && CONTAINS ( Downstream, [Node], CurChild ),
            "Both directionalities",
                CONTAINS ( UNION ( Downstream, Upstream ), [Node], CurParent )
                    && CONTAINS ( UNION ( Downstream, Upstream ), [Node], CurChild ),
            CONTAINS ( UNION ( Downstream, Upstream ), [Node], CurParent )
                && CONTAINS ( UNION ( Downstream, Upstream ), [Node], CurChild ) // Default case
        )
    RETURN
        Result

    If you delete the Visibe variable and replace the RETURN statement with the above I think that should work.