Filter tables based on a separate defined user-username table mapping

Hello there -

I’m looking to filter many tables across my document according to the user who’s accessing it, but tables all reference a “custom user name” not their “user” / account (i.e. not using the user() command. I’ve seen a few suggestions on how to do this such as this one - but my document does not already have rows in every table with user() referenced and adding it would cause complications.

Tables are filtered by this “CustomName” field as my document will show - and this is a field that already exists in every table. I thought by adding a “user mapping” table that pulls the user() function and maps it against the CustomName that filtering views would be simple, but for some reason I can’t get it right.

I’ve tried using a filter dropdown using a quick bonus “Control” table, which when “all” is selected correctly displays the “Control” table according to who’s looking at it, but I don’t wish to create a filter dropdown control for every single table. Attempting to use this control as a filter for the “task list” with something like (the sample table I’d like to filter ‘correctly’) simply displays no results (i.e. tasklist.customname.matches(user filtered matches)). I have tried writing things like tasklist.filter(user mapping.customname=task list.custommname) but that doesn’t seem to work either.

Would someone be able to help me define how to write the filter condition so that the “task view” table displays only the single result that should be there for each user, depending on who’s viewing? I.e. show 2 tasks when Sean Meehan (me) opens the doc, but 4 tasks when Boaty McBoatface opens the account (my test account)?

Thanks in advance!

Hi Sean! Taking a look at your test doc now. Just to confirm, are you wanting to filter the table Task List by the custom username? If so, the way I’d do this is filter the entire table with this:

Within your table Task List, the CustomName column is pulling in rows from the User Mapping table. This allows you to reference the User() value from the first table to filter the second.

Let me know if this isn’t quite what you’re looking for–happy to take another look!

1 Like

Oh man, delayed response here but yes that’s it! That was so simple… I could have sworn I tried doing that but I must not have. It works perfectly, both in test doc and my real one. I had ended up going through and adding User columns to every table I needed - it didn’t take that long, but added some sloppiness for sure. This would have been neater and I’ll use this going forward!

Thanks @Charlotte_Espeland !

1 Like

No problem at all, happy to help!