Sep 09, 2021 03:17 AM
I used a very painfull and well known here workaround until now to update the listing of a (target) linked field depending on the selection of another linked field.
But, I have a premium account and access to scripting.
I wonder if it’s possible to alter a view of the target linked field with a filter based on a common field value (existing in both tables) (and maybe other things but for instance just this).
I was thinking of it because we can restrict a linked field by a view.
In summary, it needs:
So, is it doable with scripting ?
Thanks a lot for your thoughts.
Sep 09, 2021 04:28 AM
Scripting cannot alter the configuration of a view. At best it can alter the value of a field for records in a view. For example you could have a view filtered by a checkbox and then you can have the script set or clear that checkbox for all records in the table, depending on the value in you common field.
But this workflow seems cumbersome. You would have to click a button to run the script, and then click in the linked record field to add the new record. There would be less back-and-forth if the user selected the new linked record in the script.
Sep 09, 2021 05:03 AM
Thanks @kuovonne for this feedback.
I really thought it was possible to alter a view.
I forgot to mention that it would be nice if the script could run on user action. But maybe it’s not possible too.
It’s a shame that a functionnality (interdependent fields behavior / conditionnal fields values) is missing especially when a lot of users asked for it.
Still looking for a straight solution that don’t require junction tables, extra fields and is usable in more than one record at a time.
Sep 09, 2021 05:11 PM
t depends what you considering “alter”. you can change # of records in a view via script, if the view depending on filter. But you can’t change it in “vertical” axis (at least without bulky workaround
Sep 10, 2021 02:06 AM
Everything you mentioned is doable, and the inability to alter view configurations is a mild inconvenience at best - Airtable views are nothing but fancy Array.prototype.filters.
But as Kuovonne already suggested, you might want to rethink what exactly it is you’re trying to do here. What’s the end goal? Or at least the criteria for surfacing the desired records?
Sep 10, 2021 04:53 AM
You could go a straight scripting route for picking records. Have the script filter the available records based on whatever criteria you want and the have the user add records in scripting app. No extra junction tables or fields. Usable by multiple people for different records at the same time. I’ve written multiple scripts for clients that does this.
Rearranging linked records and deleting individual linked records is a bit of a pain in scripting due to the limits of the user interface, so you might want to keep doing those in the regular user interface.
Sep 15, 2021 02:02 AM
Well I’m curious about this. But I’m no developer :’(
Do you have an example of a script which could filter a field based on user’s selection in another field?
Sep 15, 2021 04:11 AM
No, I do not have a sample script to give away, but I do write scripts that work as I described for clients. If you are interested in hiring me to write a script, you can book an appointment.
Sep 15, 2021 04:34 AM
We are a small non-profit association and our budget don’t allow us to hire someone on these questions. That’s why we are trying to figure out by ourselves or with a little help of the community.
Thanks for the proposal.
Sep 15, 2021 03:28 PM
Yeah, creating complex user interfaces inside the Scripting block is extremely difficult because of the security restrictions. So, while it can be done, this is pretty deep in the work-for-hire territory. Sounds like an afternoon’s of work at least. The alternative is to get stuck in learning JS for a couple of months.
But while you can’t alter views directly, the aforementioned direct route does sound like the optimal approach. Or just poll the same records view filters poll and update them, thus altering their contents indirectly.
This script follows that line of thinking to manipulate the contents of a simpler view. One that contains only a single record.
Jan 04, 2023 08:12 AM
Hey everyone, I gave up a while on this problem because it seems too complicated for me to resolve.
Anyway, API to manipulate views is really missing, or maybe there's something else that exists since.
My need has not changed, but maybe my approach has: I need to compare a common field in each of tables that is referenced in a master table through linked fields, and the result of this comparison will alter the list of the other linked fields (and that could be a view, like the restrict from a view we can already use, instead it could be a dynamic view by a field because it's like filtering).