A particular stored calc not refreshed


I’ve the Facility type with many stored calc fields, all of them are populated after Facility.refreshCalcFields() except one. Below is the definition of the type and the non populated field unUpdatedField.

type Facility {

  answers: [AssetAnswer](source)

  unUpdatedField : string stored calc "answers.(question.id=='ent_question_nome' && userSelection=='answered').userAnswer ? answers.(question.id=='ent_question_nome' && userSelection=='answered').userAnswer : name"

When I check, I see that there are data that can be used to populate the calc field.

c3Grid(Facility.fetch({"filter":"denormChildren.to.ownerOrgs.id == '1' && !exists(parent)", include: "answers.(question.id=='ent_question_nome' && userSelection=='answered').userAnswer"}))

This same definition works on another environment with same platform version 7.6.1!

Any idea why this particular field is not been populated?


You can try to look for errors in calcFieldsQueue


The refrechCalc fields seem to generate batch jobs of type RefreshCalcFieldsBatchJob:

> job = Facility.refreshCalcFields({ids: ['10']})
> c3Grid(job)

So looking to this jobs I see the follow error with c3Grid(RefreshCalcFieldsBatchJob.fetch()):

errorMsg: id: 10 error: Object with same values already exists in type Facility for unique index: C3_2_ASSET_ELS_K for object with id 10. Please change to unique values.

I guess I have to clean this index!


Did you try to first run Facility.refreshCalcFields({ids: [‘10’], clearFields: true}) and then your command?
But looks like we should file a bug.


I was not aware of the clearFields flag! I don’t know if it’s bug, I’ve created a ticket and this issue is resolved (don;t know how).

closed #6