Problem with refreshing value of a variable

Hi,

I got a form with an editable grid layout. on each row it can be added an amount. This is populated by a Rule input that contains :

  • FeuilleFrais -> CDT
  • FeuilleFrais.montantTotal -> total amount.
  • FeuilleFrais.listeFrais -> list of another CDT
  • FeuilleFrais.listeFrais.montantConverti -> the amount for the row.

I have a local variable that store the total amount and which is updated each time that one field montantConverti is updated :

  local!total : 
  a!refreshVariable(
    value:    if(
      isnull(ri!FeuilleFrais.listeFrais),
      0,
      if(
        sum(ri!FeuilleFrais.listeFrais.montantConverti)>0,
        sum(ri!FeuilleFrais.listeFrais.montantConverti),
        0)
    ),
    refreshOnReferencedVarChange: true,
  ),

This part is working fine.

Now I try to update the value of local!total into ri!FeuilleFrais.montantTotal.

This working fine when I submit the form, I got the right value into ri!FeuilleFrais.montantTotal. Now comes my issue, I do have a button to do some conversion and basically update the value of all the fields FeuilleFrais.listeFrais.montantConverti. As FeuilleFrais.listeFrais.montantConverti has been modified local!total is then also modified. This is working fine.

But even if I add : a!save(ri!FeuilleFrais.montantTotal, local!total) afterwards in my save into section the value of ri!FeuilleFrais.montantTotal is not updated with the current value of local!total but with the previous one.

If instead of local!total i add the complete code in the a!save function then ri!FeuilleFrais.montantTotal is correctly upated.

I guess that my issue is due to some variable refresh issue but I can not see where. for now as a workaround I have to replace local!total by all the logic to compute it.

Any idea on what I m doing wrong ?

Thanks for your help.

Nicolas

  Discussion posts and replies are publicly visible