Change editable status for Parent\Child records

AY2450
New Member

Hi Community,

I need to set a parent and associated child records to non-editable based on the change of a field in the parent record.

I have Diets (parent) and Diet components (Child) with an approval field for use by admins only - when a diet is approved I wish to make that particular diet un- editable.

I have tried editableif() changes on the field but it seems to make it un-editable for all records.

Any ideas?

Cheers

AY

Solved Solved
1 1 175
1 ACCEPTED SOLUTION

Itโ€™s not clear if your intention is to make the entire row un-editable or only a set of columns un-editable.

If it is the entire row, then I would suggest disabling the Edit action to prevent changes to the โ€œapprovedโ€ rows. You can do this by adding an expression into the โ€œOnly if this condition is trueโ€ property of the system generated Edit action for each table - Diets and Diet Components.

Assuming you have an [Approved?] column on the Diets row, the expression in the Diets Edit action would be:

[Approved?] <> TRUE

For Diet Components, Iโ€™ll assume that the proper Parent/Child relationship has been established and that the status still needs to be checked on the Parent record. Letโ€™s say that the id of parent row is saved in a column named simply [Diet]. Then for the Diet Components Edit action, the expression would be:

[Diet].[Approved?] <> TRUE

If you wish to make a set of columns un-editable, then you would use the same expressions above but placed in the Editable_If property of those affected columns.


CAUTION: If you make the entire row uneditable, you will not have a way to make it editable again (in the event of mistake) UNLESS you create some backup plan for this use case, e.g. change the approved column in the datasource directly, or some such back door to correct the problem.

The same problem is true if the [Approved?] column is made uneditable.

View solution in original post

1 REPLY 1

Itโ€™s not clear if your intention is to make the entire row un-editable or only a set of columns un-editable.

If it is the entire row, then I would suggest disabling the Edit action to prevent changes to the โ€œapprovedโ€ rows. You can do this by adding an expression into the โ€œOnly if this condition is trueโ€ property of the system generated Edit action for each table - Diets and Diet Components.

Assuming you have an [Approved?] column on the Diets row, the expression in the Diets Edit action would be:

[Approved?] <> TRUE

For Diet Components, Iโ€™ll assume that the proper Parent/Child relationship has been established and that the status still needs to be checked on the Parent record. Letโ€™s say that the id of parent row is saved in a column named simply [Diet]. Then for the Diet Components Edit action, the expression would be:

[Diet].[Approved?] <> TRUE

If you wish to make a set of columns un-editable, then you would use the same expressions above but placed in the Editable_If property of those affected columns.


CAUTION: If you make the entire row uneditable, you will not have a way to make it editable again (in the event of mistake) UNLESS you create some backup plan for this use case, e.g. change the approved column in the datasource directly, or some such back door to correct the problem.

The same problem is true if the [Approved?] column is made uneditable.

Top Labels in this Space