35
Views
9
Comments
How do update only 2 fields of the table

How do do to update only 2 fields of the table ?

Because, in the example below I don't want updating the field ADDRESS, but in the way that is, if I don't fill nothing in this field, the field is updated with empty.




UpdateOnly2Field.png
2020-07-21 19-28-50
Rajat Agrawal
Champion

Hi Vivian Mattos,

Instead of passing null you can send the value you have already for that address means DB value you can pass in it while updating that record.

Pass that specific ID which you are updating and fetch your address field data and pass on it.

Hope this helps you!!!

Regards,

Rajat

UserImage.jpg
Vivian Mattos

Hi @Rajat Agrawal thanks for answered, I thought in this way too.

But I need discovery if there is some way in Outsystems of the update only some especific fields.

Do you know, if there is ?




2020-07-21 19-28-50
Rajat Agrawal
Champion

Yes, you can pass aggregate value in that entity action instead of local variable. So it will take automatically address value and what ever value you need to update that you can assign in that aggregate before update action.

Because for update we have to pass value without passing we will not update.


Regards,

Rajat 


UserImage.jpg
Md Mansur

Hi @Vivian Mattos 

I have also Attached oil File so go though this:

Thanks

Md Mansur

LocalUpdate.oap
UserImage.jpg
Vivian Mattos

Hi @Md Mansur thanks for answered.

But in mycase the project is not using Aggregate, the project is using a List.

I attachemented a example of the OML with this case List.

2025-02-10 17-24-13
Arun Rajput

Hi Vivian,

If you want this way then use Advance SQL instead of entity crud actions.


-Arun

UserImage.jpg
Vivian Mattos

Guys,

I attachmented the OML.

I need to update only the two fields exist in the LIST, but the Mapping show for me all fields of the table.

How do updated only 2 fields ?


Field Address.png
AlunoUpdate.oml
2019-01-07 16-04-16
Siya
 
MVP

Please find an implementation using json and advanced SQL. Here you will be passing the list of values (id, Name ) as json to advanced query.  This SQL script reads a JSON array and updates the Name field in the Student table for each matching Id. 


BulkUpdate.oml
2022-02-03 15-55-20
Diogo Pereira

Hi,


Through the CRUD actions that are associated with the Entities you need always to pass all attributes, so if you don't want to update certain field, you need to pass the value that is already in DB.

Other way you can do what you really want is trough Advanced SQL Query where you do an Update Statement by updating only the field you need.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.