Disallow adds & edits to child table, if parent record status column = "closed"

I have tried to add a condition to the “Add” action for the child table as follows -

Lookup([TaskID],“TaskList”,“UID”,“Status”)<>“Closed” (see screen shot)

  • TaskID is the ref for the child row from parent row
  • Task List is the parent table
  • UID is the key field in the parent table
  • Status can be “open” or “closed”

but this does not work.. the add action continues to appear

I think this is because the condition is supposed to refer to rows of the child table, not the parent..

should I look at the table settings.. (“are updates allowed?”) of the child table?

pls help. thanks.

Please create a read only slice called say “RO_Child_Slice” on the child table.

Please create a reverse reference virtual column in the parent table called say [Related Child_Table_RO] with an expression something like REF_ROWS(“RO_Child_Slice”, “UID”)

Now in the new reverse reference column in the parent table [Related Child_Table_RO] , please add a show_If condition of [Status] = “Closed”

Edit: In the existing reverse reference column in the parent table that must be having a name something like [Related Child_Tables] , please add a show_If condition of [Status] = “Open”

Essentially the app shows related child records from a read_write table or read only slice based on the [Status] column.

This is well explained in the posts below

Solved: How to remove the Add option in my Related Child T… - Google Cloud Community

Solved: Disable add button of child/related table from Par… - Google Cloud Community

3 Likes

Hi Suvrutt.. thank you for the detailed inputs and the Edit.. finally got it to work, as follows -

  1. created a ready only slice of the child table. (in case anyone else is wondering, the slice does not require any filter condition; it’s simply a copy of the existing table, albeit read only)
  2. added one more virtual ref_row column to the parent table, referring to the slice.
  3. set the show if of the original virtual ref_row column to [Status]<>“Closed”.
  4. set the show if of the new virtual ref_row column to [Status]=“Closed”.
  5. For the child table (Add & Updates permitted), the system automatically generated Detail, Form & Inline views (which I could tweak). Similarly for other slices made from the parent table, D, F & I views were auto generated. Strangely, for the Read Only slice of the child table, no views were auto-generated. Therefore, I created Inline & Detail reference views, which I could tweak to match D, F & I views of the child table.
  6. Conclusion - Inline views of “not-closed” parent rows look exactly like those of “closed” rows.

:folded_hands:t3: :folded_hands:t3:

1 Like