Save a value in to DB at the same time

Save a value in to DB at the same time

  

Hi,

Im trying to save a value in to tables at the same time but I have not been successful. My plan is this one.

I want to save a Form in main the DB but the value "unloading_date" should be saved in another data base to. Right now I dont have any idea that how to make it. 

Hi,


what is the issue exactly?

you cannot do it in parallel, but I don;t see the issue doing it sequential.


Hi,

Why haven't you been able to?

Can't you update one table after the other in the same action? This will be done in the same transaction if one rolls back the other will be too.

Best regards,

Marcelo

What I want to do is Save the Red underline Collum in the green Ones when I do the save Action in Italia_PT_IT Form.


Hi,


I am a bit confused. This is a basic assign and create/update actions.

I do notice that the Trailer_Plate in Italia_Trailer is not a FK, so perhaps that is an issue.


Am I missing something?



Hi J.,

I think you're right. The issue is the foreign key...

@Henrique, do the CreateOrUpdate first of the variables of type Italia_Trailer and of type Italia_Container. These CreateOrUpdates will give you two Ids (the output of the CreateOrUpdate Entity Actions). You can then use these Ids to set the attributes of the variable of type Italia_PT_IT.

Is that it?

Cheers,

José

Im sorry about my bad communication. I just want to know the right way to save the same value in different tables at the same time. At this moment I am capable to save the value on two different tables, with the assing. My problem is the value, becuase, no mather the "Container" that I sellect, it always get the value on the same row...

Some images to compensate my bad english:

I select the Container with the ID 5 and the value is saved on the row 11.

Hi,

If its saving in a incorrect row you should have some bug in your code. Is possible to share the espace or some print screens of the save action and the assigns.

Regards,

Marcelo

You image is cut. And we really need to check whats is being done on those 2 assigns.


The first assing is to get the name of the username. the second is that one.

GetItaliaContainers has all the containers correct? before assign anything there you need to choose the correct one. You can do a GetForUpdate with the variable that is linked to the combobox where you selected the correct container. Or if you want to save the database call you can loop through GetItaliaContainers till you find the one selected on the combobox.

Regards,

Marcelo

Solution

Hi Henrique,

Just to be a little bit more explicit about what you are doing.
In the assign widget, you are assign the values you want to save in the Italia_Container entity from the GetItaliaContainers.List.Current.Italia_Container and late using it as the source to your CreateOrUpdate action.

The question is: Do the GetItaliaContainers.List.Current have the right record?

If you are executing it in the action itself, are you filtering it using the ID selected in the form?

If this aggregate is from the Preparation, and you are using it to feed the Combo box where you select the id, you should instead (both for performance as well as correctness), to use a GetItalia_ContainerForUpdate using the ID selected (from the form), than an assign to change just the items of the returned record to the values you want to change, and than use this record to update in the UpdateItalia_Container action.

Cheers,

Eduardo Jauch


Solution