List - Filter by Switch to show different types of items

Hi, in my app we have reports submitted by users that are shown in a list. I want to add a filter to be able to show types of reports based on the user type who submitted them (Pro or All).

Users are marked as Pro or not with a True/False in the User collection.

I’m trying to figure out a way to do this, starting off with the Switch component, but the List filters only let us select True or False, not to show based on the switch input.

Has anyone got some ideas of how to achieve this?

Here is a quick video overview: https://www.loom.com/share/da633b9086ec499399f0606a1b3812f5

1 Like

Bump… anyone have any ideas. @Colin have you tried something like this?

Hi @TonyD,

Switch (like a Toggle) is directly attached to some True/False property of a record in a collection.
I don’t see any easy way to do what you want with a single switch, all it requires a bit of work.

One option which I can suggest: you could have 2 lists (pro and non-pros), have some tmp true/false property (call it “showprolist”) for logged-in user (which list to show), attach switch to this property, and then change lists visibility based on it.

Another option would be to have 2 screens with the same lists but different filters.

Best,
Victor

1 Like

@TonyD

I did a quick mockup to achieve what you want. 2 screens with a custom toggle on top. Hopefully this helps.

2 Likes

Awesome, I will check it out!

So I checked that out, and that makes sense, however I am looking to filter the list of Dive’s by the user type who submitted them. So I might need to add something to the reports that indicates the user type that made them. I was just hoping to be able to use the property I already had for the user and not have to duplicate that data point. hmm…

For now I just did the two views, it is a bit clunky with the screen reload, but it works.

Would still like to find a cleaner way to do this.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.