Only allow updates by Context("Table")?

I have a form for my “Stock In” table, that has a reference to my “Medication” table.
I only want to allow users to add a row to the Medication table using the Medication form.
When a user adds a new “Stock In” item via the form, the Medication field is a modal that lists the Medications as well as a “New” option. I want to disable the “New” option from the “Stock In” form.
I’ve tried adding a switch to the “Are updates allowed?” expression of the Medication table, like so

  "Medication", "ADDS_ONLY", 

Seems like that should work wonderfully but that hides the + button on the Medication primary view.
Why doesn’t that work?
I’ve also tried switching on Context(“View”) but no luck there either. It displays the + button on the Medication view but then when I click it I get an error “Table Medication does not allow new entries” because the view has changed to be the form (which I noticed doesn’t have a View param in the URL).
Any other ideas for disabling additions from the reference modal?

Hi @CMA-Admin

Welcome to the community !

I think you have the “New” option because your field refers to the table, which allows adds.
It probably looks like this in the Data/Table panel (please replace Products with Medication in your case):

To avoid this, you have to create a slice with ReadOnly options.
That will work like an identical twin of your Medication table, but with no change allowed.

To do so:

  • create a new slice that I suggest you call Medication_ReadOnly, and check these informations (remember to substitute Products with Medication from my example):

  • on your “Stock In” table, click on the black pen:

  • then, change your Source table, from Medication to Medication_ReadOnly

Let us know if that works for you !


Great alternative! That makes sense. I will try this when working on it tonight.
That’s a great approach in general for creating read-only lists from tables. I’ll add that to my quiver of tricks.