@FetchOne / Draft pattern with dependent relationships (Property -> Room -> Item) #311
-
|
My Database is Properties >> Rooms >> Items so one more level of relationship beyond the Reminders app example. I want to be able to change both the property and the room when creating or editing an item. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
@StewartLynch If this is a dynamic form, where relations/rows may not be inserted yet, While not exactly your situation, the reminders form is a good example of creating/updating a reminder using a draft, and then batching the write in a single transaction so that tags can be written with the foreign key. Let us know if you have any questions, though! |
Beta Was this translation helpful? Give feedback.
-
|
Yes, thanks for this. I have it working now. I pass in the current property from the presenting view and all is good now. |
Beta Was this translation helpful? Give feedback.
@StewartLynch If this is a dynamic form, where relations/rows may not be inserted yet,
@FetchAlland@FetchOnemay not be appropriate for loading the editable data. Instead, you can manually load the data into draft structures and then in a save action you can manually write back to the database.While not exactly your situation, the reminders form is a good example of creating/updating a reminder using a draft, and then batching the write in a single transaction so that tags can be written with the foreign key.
Let us know if you have any questions, though!