Field reference error

Field reference error



Having a vexing problem.  I created a series of fields to summarize values, the details aren't important, but essentially I have a Field and FieldYTD.

The problem is that when I debug, the assignments of values to Field and FieldYTD are correct via the debug window... but when the values are physically posted to the Entity, the values get swapped (e.g. the calculated value for FIeld goes into FieldYTD, and the calculated value for FieldYTD goes into Field).

I've been working on this app for some time, so early memory is a bit hazy, but I believe when I first implemented the Entity that I had the field order swapped (e.g. FieldYTD went first) and I later changed the names of the two fields (so FieldYTD is now second).  Could there be a metadata synch issue that is keeping the original name/field position and posting the field values to the incorrect spot?

As I can't see the inner workings of the default "Create..." or "Update..." Entity actions, I cannot trace that piece of the code through the debugger. But it is evident that what is calculated in my Assign is not going to the correct output field.

Any ideas for how to clear this?  Many thanks to the Community -- always very helpful.

Hi there,

That's odd. When the Create/Update action is being called are the values still correct? If so, can you share a small oml that could reproduce the idea. By the way, are you running this application on a cloud environment or on your own environment.

José Caldeira
Hi Steve,
Trying to help as possible...
On those actions (CreateOrUpdate) what is the Source you're using in the action?
Being a Simple query or Aggregate, no maintenance is needed if Used Entities change. Is the Source an Advanced Query? (possibly with an Entity as Output instead of a Structure?)
May that be the origin of the mix-up of the fields?

Thank you both for the quick response -- again the Community comes to the rescue!

Tiago was right-- when I updated the Entity definition to change the order of fields, I had left the order of fields in my Advanced Query to the old sequence.  I assumed (!!) that the mapping from the Advanced Query --> Output record structure was *name*-based, but instead it must be *position*-based.  Once I swapped the field order in the Advanced SQL to match the Entity order the fields are now correctly updated (and an important learning for me, as I used Advanced SQL functions quite often).

Many thanks for helping resolve the issue!