CreateOrUpdate action isn't updating

CreateOrUpdate action isn't updating

  
Hi!
I have been stuck in this problem, and I cant solve it.
Im using a CreateOrUpdate action without any problems in my application.
Meanwhyle, in an action to import data from an excel file, the very same CreateOrUpdate action allows me to insert but it never updates the table.
The excel file was created by the ExcelToRecordList widget, than some cells are changed and then when I try to update the table, the changes never commit to the table. If I add a line to the excel file, it is inserted in the table, without any problem. But update, it never happens!.
There is now exception raised, so there is no data error.
The CreateOrUpdate action returns the correct ID, so no problem with the ID.
I don't know what to do next.
Is there a way to debug what happens inside the CreateOrUpdate action?
Can someone advise me on other tests or if this happened before?

Thanks in advance

Antonio
 
 
Hello! Me again!
Now it works.
I was using the ExcelToRecord list in the CreateOrUpdate.
Now I followed the tutorial and had assigned the ExcelToRecord to the query, use the query in the action instead and now it works!
What puzzles me still, is why it inserted new records whyle it didnt update?
And why there is no error, at least that I was aware of?

Antonio

Hi Antonio,

The CreateOrUpdate<Entity> action will update a row in the database if the Id (PK) of the entity is filled in (on the record you provide to the action).
If the record Id is empty, it will create a new row.

So, when you are importing data from excel, you need to check, for each line, if the record already exists in the database (query), and then use the CreateOrUpdate action with the result of the query. It will then work on the 2 acenarios above.

Cheers,
Paulo
Paulo Ramos wrote:
Hi Antonio,

The CreateOrUpdate<Entity> action will update a row in the database if the Id (PK) of the entity is filled in (on the record you provide to the action).
If the record Id is empty, it will create a new row.

So, when you are importing data from excel, you need to check, for each line, if the record already exists in the database (query), and then use the CreateOrUpdate action with the result of the query. It will then work on the 2 acenarios above.

Cheers,
Paulo
 
Hi Paulo

Im sure that the Id was filled in.
I had the Id in the excel file because the excel file was also a result of a previous export of the same table.
Than, if I change one of the fields in the excel file and import it, nothing happens. 
The action even returned the Id as result of the action, but nothing happens, no update.
As I said before:

I was using the ExcelToRecord list in the CreateOrUpdate.
Now I followed the tutorial and had assigned the ExcelToRecord to the query, use the query in the action instead and now it works!

There should be another explanation!
Thanks
Antonio

Strange... if you can post your non-working version of the eSpace, maybe we can take a look at it. :)
Hello,

Are you using CommitTransaction in the end of the loop?
If any error happends it can goes to the exception and abort all the transactions. The effective transaction to the database is only made in the "End" or if u force the commit.


Antonio Xeira wrote
:
Hi!
I have been stuck in this problem, and I cant solve it.
Im using a CreateOrUpdate action without any problems in my application.
Meanwhyle, in an action to import data from an excel file, the very same CreateOrUpdate action allows me to insert but it never updates the table.
The excel file was created by the ExcelToRecordList widget, than some cells are changed and then when I try to update the table, the changes never commit to the table. If I add a line to the excel file, it is inserted in the table, without any problem. But update, it never happens!.
There is now exception raised, so there is no data error.
The CreateOrUpdate action returns the correct ID, so no problem with the ID.
I don't know what to do next.
Is there a way to debug what happens inside the CreateOrUpdate action?
Can someone advise me on other tests or if this happened before?

Thanks in advance

Antonio
 
 
 
 
Hello,

Are you using CommitTransaction in the end of the loop?
If any error happends it can goes to the exception and abort all the transactions. The effective transaction to the database is only made in the "End and if everything goes well" or if u force the commit.


Antonio Xeira wrote
:
Hi!
I have been stuck in this problem, and I cant solve it.
Im using a CreateOrUpdate action without any problems in my application.
Meanwhyle, in an action to import data from an excel file, the very same CreateOrUpdate action allows me to insert but it never updates the table.
The excel file was created by the ExcelToRecordList widget, than some cells are changed and then when I try to update the table, the changes never commit to the table. If I add a line to the excel file, it is inserted in the table, without any problem. But update, it never happens!.
There is now exception raised, so there is no data error.
The CreateOrUpdate action returns the correct ID, so no problem with the ID.
I don't know what to do next.
Is there a way to debug what happens inside the CreateOrUpdate action?
Can someone advise me on other tests or if this happened before?

Thanks in advance

Antonio
 
 
 
 
lpsoares wrote:
 
 
 
I tried bouth: with and whithout transaction in the end.
Nevertheless, if I understood well, a commit is sent to the database in the end of the complete action.
Paulo: I will try to look for the old version that was doing this and publish it here asap.
Antonio Xeira wrote:
 
I tried bouth: with and whithout transaction in the end.
Nevertheless, if I understood well, a commit is sent to the database in the end of the complete action.
Paulo: I will try to look for the old version that was doing this and publish it here asap.
 
 Ok... i will take a look after on your eSpace if you want.