Updating Progress Bar With Button

Certified Senior Developer

Hi!

I want to update a progress bar with a value retrieved from DB. For this, I use a Expression Rule that gives me this data.

To update the progress bar I use a button to update the progress bar value, calling the Expression Rule. I save this return value on a a local Variable and uses it to update the progress bar values. The problem is that the return value of the Expression rule is only returned the first time I called it or when I refresh the page, which is the same. After this, I can't refresh the local variable value.

Anyone knows why this happens?

Thanks in advance, here is my interface code:

a!localVariables(
  local!rpaProgressRefresh: rule!FSA_GetRPAProgressByCovidAreaId(
    ri!FSA_CovidArea.id
  ),
  local!rpaProgress: a!refreshVariable(
    value: rule!FSA_GetRPAProgressByCovidAreaId(
      ri!FSA_CovidArea.id
    ),
    refreshAlways: true()
  ),
  {
    a!sectionLayout(
      label: "RPA Data",
      contents: {
        a!columnsLayout(
          columns: {
            a!columnLayout(
              contents: {
                a!integerField(
                  label: "Total Recovered Cases",
                  labelPosition: "ABOVE",
                  value: ri!FSA_CovidArea.totalRecoveredCases,
                  readOnly: true
                ),
                a!integerField(
                  label: "Active Cases",
                  labelPosition: "ABOVE",
                  value: ri!FSA_CovidArea.activeCases,
                  readOnly: true
                )
              },
              width: "MEDIUM_PLUS"
            ),
            a!columnLayout(
              contents: {
                a!integerField(
                  label: "New Recovered Cases",
                  labelPosition: "ABOVE",
                  value: ri!FSA_CovidArea.newRecoveredCases,
                  readOnly: true
                )
              }
            )
          }
        ),
        a!columnsLayout(
          columns: {
            a!columnLayout(
              contents: {},
              width: "WIDE"
            ),
            a!columnLayout(
              contents: {}
            )
          }
        )
      },
      divider: "BELOW"
    ),
    a!sectionLayout(
      label: "RPA Progress",
      contents: {
        a!buttonArrayLayout(
          buttons: {
            a!buttonWidget(
              label: "Update RPA Progress",
              icon: "refresh",
              value: rule!FSA_GetRPAProgressByCovidAreaId(
                ri!FSA_CovidArea.id
              ),
              saveInto: {
                local!rpaProgressRefresh
              },
              submit: false,
              style: "NORMAL"
            )
          },
          align: "START"
        ),
        rule!FSA_RPA_ProgressBar(
          local!rpaProgress
        )
      },
      showWhen: ri!isInRPA,
      divider: "BELOW"
    )
  }
)

  Discussion posts and replies are publicly visible