Forum Discussion
Walter_Mangy
1 year agoNew Member
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...
- 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 ResultIf you delete the Visibe variable and replace the RETURN statement with the above I think that should work.
johnt75
1 year agoSuper User
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.
Walter_Mangy
1 year agoNew Member
Thanks a lot Johnt75, support was prompt and relevant. Incredible work, all the best!