Is there a way to simply add an item to an ANY() list?

I’ve got a list of column of “States”. I’m using a detail view as a dashboard filter as described in this video: Dynamic Dashboards

I’m trying to allow the user to select a list of states but also always include the “state” ‘AD’. AD is the acronym for the total division. Essentially the data includes programs that are for AD and specific state programs. When the user selects a state or a couple of states this filter will return programs from AD + the selected states. Here is 1 part of my AND expression in the Slice filter:

IF(ISBLANK(ANY(QRManager Map[State Filter])), TRUE,[State] = ANY(QRManager Map[State Filter])),

How do I add AD to the list of states in the (QRManager Map[State Filter]) column?

Dang it… I thought I had it by adding an OR() around this expression
AND(
OR(IF(ISBLANK(ANY(QRManager Map[State Filter])), TRUE,[State] = “AD”),
IF(ISBLANK(ANY(QRManager Map[State Filter])), TRUE,[State] = ANY(QRManager Map[State Filter]))),…

This only returns AD + one of the other states selected.

QRManager Map[State Filter] + {"AD"}

See also:

IF(ISBLANK(ANY(QRManager Map[State Filter])), TRUE,[State] = ANY(QRManager Map[State Filter]) + {“AD”}),

gives me back an error:
Arithmetic expression ‘(ANY(QRManager Map[State Filter])+LIST(“AD”))’ has inputs of an invalid type ‘Unknown’

You didn’t use what I suggested.

You are right! I moved the parentheses and the error goes away!

But have realized another issue. When I select multiple states, my filtered view only returns the first state in the list. When I clear the field the view shows all states and AD.

1 Like

So this:

IF(ISBLANK(ANY(QRManager Map[State Filter])), TRUE,[State] = ANY(QRManager Map[State Filter] + {“AD”})),

is a slice row filter?

And QRManager Map[State Filter] refers to an EnumList column?

If yes to both, try this instead:

OR(
  ISBLANK(QRManager Map[State Filter]),
  IN([State], SPLIT((QRManager Map[State Filter] + {“AD”}), ","))
)

That Did It!!! I was wondering if it had something to do with those pesky commas!

Just so I understand what you did here. By using the SPLIT expression you essentially removed the commas from the list?

Yes and yes, This is a slice filter and I am using an Enum List in this column. For future reference, Enum List the part that doesn’t like the commas? btw…i’m using Valid If field to generate my enum list.

Once again, Amazing Support from Appsheet!!!

1 Like