A particular stored calc not refreshed


#1

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?


#2

You can try to look for errors in calcFieldsQueue


#3

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!


#4

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


#5

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