Save one input in two tables

Hello,

I am working on a reactive web app and I have encounter difficulties trying to save the same input of a form in two different tables. Better explain, I have two tables A and B, with one (A) to many (B) relationship, there is a specific attribute of A  that I want to update every time the form for B with the A Id identifier gets record. I have tried to use a server action with Create/Update A and Update A adding it in the Save Action of the B form, but it updates the full A record not only the field I want. How can I get to update only one field of a form in this case?

Solution

HI Yomarie,

You can use advance sql for that.

  1. create a server action and use advance sql like-
  2. Update {Table A} set {Table A}.[ColumnName]=Value where {Table A}.[Id]=@ID
  3. @ID is your input parameter in advance sql
  4. Use one structure for output purpose that query will not return anything but it is mandotry to take entity/Structure
  5. use this server action in the client action where you need to update this


Hope this will hep you.

Regards

Rahul Sahu

Solution

Yomarie Hichez wrote:

Hello,

I am working on a reactive web app and I have encounter difficulties trying to save the same input of a form in two different tables. Better explain, I have two tables A and B, with one (A) to many (B) relationship, there is a specific attribute of A  that I want to update every time the form for B with the A Id identifier gets record. I have tried to use a server action with Create/Update A and Update A adding it in the Save Action of the B form, but it updates the full A record not only the field I want. How can I get to update only one field of a form in this case?

 Hello Yomarie,

If you will use inbuilt Create or Update action, it will be affected to complete record. I would like to suggest you to use SQL widget in server action(as it only available in server action). You will have to pass ID of entity to SQL quesy, then you can use that ID to filter Record and update the desired field. Like below screenshot :

 Hope it helps.

Cheers,

Sanjay

Now it's working, thanks to both of you!

Best regards,

Yomarie