Update behavoiur set to changed attributes problem

Update behavoiur set to changed attributes problem

Hi all.
I'm trying to update a table by importing an excel file but I found out now that nothing is being updated.
If I change de Entity Update behaviour to All atributes it works fine.
Is this a known handicap of the platform? Is there any way of controlling this problem without changing the update behaviour?

Can you share with us the eSpace doing the import?

Best regards,
Ricardo Silva
Hello Patrícia,

That's a strange behaviour..Did you try to "query" the table, with a Simple Query, before doing the import?
Just to check a thing, after the update action try to Commit the transaction, maintaining the entity update behaviour just to the changed attributes.
Say something about the result.

Kind Regards,
Gonçalo M.
Hi Patricia,

You can always Get the value with a query and then assign the value in the excel, this way the platform will always detect a "change" because it has the original value. 

If you simple iterate the values in the excel record list and then make an update for each row it might not detect that change (I'm not saying that's not a bug).

Thank you all and sorry for the late reply.

Gonçalo Martins just the commit doesn't change anything.
Hélio Dolores I have tried that and it works.
But now I would like to know which is the worst way to the application performance, making one more query per excel line or changing the entity changed behaviour.
Still can't understand if it's a bug or not.
Hi again Patricia,

Changing the behaviour to "All attributes" will decrease performance in all updates over that Entity and will also force the get of all attributes from the database (in a Get -> update scenario).
Instead of making a Query for each entry you can try to make one single query outside the loop and on each iteration assign all attributes (I think that will be enough to fool the optimizer).

If that is a bug or not.. it depends (we will have to evaluate it) because we cannot detect a change if we don't know the original value.

Hi Patricia,

Can you please send us the OML or a sample OML with the exact same pattern you've used to update (with no success)?
It will be very helpfull to us. We may have to change the semantics in some of these cases.

Thank you
Hi all, 

just to let you know, I've found the same 'bug' - when importing from excel (without first querying the entity and updating the attributes) no changes are updated, even though the record in excel is different from the one in the database.

How does the optimizer work? Does it check if the code changes an attribute before deciding to do a query or not? Or is it optimized at the database level? 

My code is simple; 

Excel to Recordlist using an entity as structure, for-each over the resulting recordlist and only an createorupdate action in the loop.

For new lines a new record is created, modified records (in excel) do no change nor create a record in the database.

Hi Hans,

The Update Behavior will update all the values changed value in runtime (and not the assigned).
The problem is that you are not changing the value, because you didn't retrieved the current value from the database in the flow - so there's no way to know if the value actually changed.

The only way to do it (with changed attributes) will be:
For every line of the excel file
- Get record with the same ID
- Assign values
- Update record


Hi Helio, 

thanks for the explanation. Would be nice to have the entity set to changed attributes, but a method to 'force' an update all attributes in parts of the action flow. 

Assigning all attributes is not the most fun type of work ;)

I agree that this isn't very funny solution.
But since you'll always need to assign the values to a EntityRecord before the update...
assign it to the Query current record instead of creating a AuxRecord.

We've discussed that option (force) in the design process, but we decided that would bring extra complexity to the feature and so we kept the update behavior granularity on the Entity.
Anyway ... I'll raise the flag for these kinds of problems to the maintenance team to see if the can do something about it.
I cannot promise anything (since this is not critical)