Mimicking the demo app " Slice based on user input", I have an interactive dashboard filter that should allow me to select a Client Name using table Filter-Client. That bit works ok. Then it should show on the calendar all dates that the client has (previously) attended.
With this formula
CONTAINS(Register[Attendees],ANY(Filter_Client[Client Name]))
in a slice (looking at Register table) for the calendar view, Iโve managed to get the calendar to recognise that, for example, Anton has attended before, but it shows ALL the dates, even those that he didnโt attend. In other words, itโs a yes/no response.
How do I get the formula to check which dates Anton was an attendee and then return just those dates on the calendar view.
T
Any pointers much appreciated.
Solved! Go to Solution.
I wasnโt completely sure how you were using the original expression.
For the slice filter criteria, you simply need to wrap the expression I provided with another IN() function. I am assuming that you have access to the RegisterID value is some way such as directly in a column in the โClient Attendance Calendarโ slice row or through a Ref column. If you donโt, be sure to add it.
IN([RegisterID],
SELECT(Register[RegisterID],
IN(ANY(Filter_Client[Client Name]
),
[Attendees]
)
)
)
Note that I used RegisterID in two places. AppSheet should be able to figure out from context that the first is in the Slice dataset and the second is from the Register table.
I believe you want to use the IN() function instead. CONTAINS()is a function meant to operate on text strings and not lists.
I think the function you are looking for is something SIMILAR to:
IN([Client Name], Register[Attendees])
This is assuming that:
If the data structure is different than I am assuming then post back and one of us can help get the correct IN() statement written with you.
@John_Baer Thatโs really useful, thanks.
However, Iโm not there yet! Iโve interpreted what youโve said to come up with:
IN(ANY(Filter_Client[Client Name]),Register[Attendees])
where ANY(โฆ) reads the Full Name of the client Iโve selected (from the FilterClient table) - the needle
The haystack: does the Attendees column on Register table contain my selected client on any of the rows? Unfortunately, if the client exists in any of the lists (under Attendees), then the calendar view shows ALL the dates, not just, say, Sat 11 Apr for Anton. If I choose a client who doesnโt appear on the register, then it rightly shows no dates, so I know the filter is connected correctly to the calendar view.
I thought about embedding the above in FILTER(), but I get: โThe expression is valid but its result type โListโ is not one of the expected types: Yes/Noโ
What am I missing here? Help!
Ok so the Register[Attendees]
portion of the IN() function gives you list of the Attendees values from EVERY row in the Register table. I assume you have Attendees defined as an EnumList? So you will get a List of Lists which effectively one big list of ALL attendees in the Register table.
In your case, If I understand correctly, you are trying to get a list of registrations the Filter client is listed as an Attendee on. So you will need an expression more like this:
SELECT(Register[RegisterID],
IN(ANY(Filter_Client[Client Name]
),
[Attendees]
)
)
This gives you a list of registrations that include the Filter Client Name.
I hope this helps!
@John_Baer Thank you, I can see how that should work, but Iโm still getting:
โThe expression is valid but its result type โListโ is not one of the expected types: Yes/Noโ
โThe filter condition โ=SELECT(Register[RegisterID], IN(ANY(Filter_Client[Client Name] ), [Attendees] ) )โ of table slice โClient attendance calendarโ must return true or false.โ
Youโre right that I use a UX form that allows the user to select from a long EnumList of Client Names (drawn from another spreadsheet table of client details). This results in a row in the Register table which includes a list of all attendees (Client Names) for that dayโs class; the Count in the next column adds up the number of attendees.
Whatโs the mis-match here, any thoughts?
I wasnโt completely sure how you were using the original expression.
For the slice filter criteria, you simply need to wrap the expression I provided with another IN() function. I am assuming that you have access to the RegisterID value is some way such as directly in a column in the โClient Attendance Calendarโ slice row or through a Ref column. If you donโt, be sure to add it.
IN([RegisterID],
SELECT(Register[RegisterID],
IN(ANY(Filter_Client[Client Name]
),
[Attendees]
)
)
)
Note that I used RegisterID in two places. AppSheet should be able to figure out from context that the first is in the Slice dataset and the second is from the Register table.
@John_Baer Yes, it works, thank you so much!! Iโm not sure about whether I have a ref column, etc but it appears to be functioning correctly.
I would never have worked out to nest an IN() within another, so will now study it until it makes sense to me
Thanks again for your prompt support
Hi,
If you donโt mind, can you please share the link of your APP because I am also trying to create the slice-based upon user input in my calendar but somehow itโs not working for me.
Thanks
Hi
Iโm really sorry, but itโs been 2 years, and it would take me a couple of days to work out how the code works. I did do a copy at some stage, but it broke, so was probably no use. Perhaps address your question to @John_Baer ?
As much as I hate to not to have a good article from here, this is the best explanation Iโve found for Dynamic Dashboard:
Also, the app refered on the OP is this:
Slice based on user input
User | Count |
---|---|
17 | |
14 | |
8 | |
7 | |
4 |