Help with upserting data to linked table data inside collapsible panel component in Codeless logic

Hello!

I’m currently building a page that pulls and displays unique data from a patient table based on a specific objectId. This part is working correctly — I can retrieve and show all the relevant patient-level fields. Logic below:

I am using the ‘collapsible panel’ component off the UI marketplace and was successful in displaying the data from the ‘patient’ and the linked table. Logic below:

I have a collapsible panel component that is housing multiple checkboxes to a 1:1 related table with the relation link called ‘condition_disease_link’. Was hoping to get some help understanding the correct way to upsert the changes to the linked 1:1 relation table. More specially for multiple checkboxes.


Logic for the checkbox:

Hello @floward-b

Welcome to our community and thank you for trying out Backendless.

We will be happy to assist you. I need to ask you a few more questions so I can understand the problem better.

Please provide your Application ID, container name, and page name.

Do you want to make changes every time a checkbox is selected? It’s better to use one general Save button, collect all checkbox values ​​at once, and create or update the entire object.

Regards,
Volodymyr

Hi Volodymyr,

Application ID: 31C4EB4E-67EE-43AD-AB7A-98EAE64463EF
Page name: pagePatient
container name: “facesheet-cd” & “facesheet-attendance”

Yes we would like the use an ‘edit’ & ‘save’ button to collect and write all changes to the respective table if possible. If you look at our page, there are multiple sections that will require an ‘edit’ & ‘save’ button each. Early stages of this feature is on the top right corner of the page where it should enable and disable the input fields.

The containers mentioned above are pulling data from different tables, ‘condition_disease’ and ‘patient_schedule’ respectively. While on the page level and rest of the fields are pulling data from the ‘patient’ table.

Looking forward to hearing back!

Hello @floward-b

For the save button logic, you can consider the following logic:

where, for your app, the following names will be:
Variables: parentObject, childObjectId
Parent = patient
Method Argument "objectId" = id from panelContent Data Model
rel = condition_disease_link
Method Argument "option1" = value for hypertension

Method Argument "optionN" = value for coronary_artery_disease

Documentation for Deep Save Update with Adding a Relation.

The above applies to the case where the child record for condition_disease_link can be either present or absent (so far, since your tables are populated, I assume this is your case).
However, if we guarantee that for every record in the patient table, there is a corresponding record in the condition_disease table, then the logic becomes simpler.

Regards,
Volodymyr

Thanks for your message, I do follow the logic. However at which level should the codeless blocks be created? Im presuming on the ‘page’ level?

It depends on your needs. If you will reuse this logic, it makes sense to do it inside the component; otherwise, yes, it could be page-level.