refreshVariables

So I'm building an interface and part of it the user can change address and add credits to his account, but when i add credits I need to update the browser in order to display the new balance value, I've been told I need to use refreshVariable but doesnt seem to work for me can someone help? heres a code snippet:

a!localVariables(
  local!filter,
  local!imagesdetail,
  local!selectedtab: 2,
  local!addingaddress: false(),
  local!addcredits: false(),
  local!user: rule!AS_Get_Account(loggedInUser()),
  local!newaddress,
  local!addedcredit,
  local!changeaddress:{name:loggedInUser(),balance:local!user.balance,address:local!newaddress},
  local!changedbalance:{name:loggedInUser(),balance:(if(isnull(local!addedcredit),null,local!user.balance+local!addedcredit)),address:local!user.address},
  local!filtered: rule!AS_Get_By_Category(local!filter),
  local!visivel,
  local!id,
  local!querycomments: rule!AS_Get_Comments(local!id),
  local!info: rule!AS_Get_By_Id(local!id),
  local!rating: 0,
  local!totalstars: 10,
  local!score: 5,
  local!comment,
  local!totalorder,
  local!stored:{productId: local!info.id, rating: local!rating},
  local!comments:{productId: local!info.id,
  comments: local!comment,
  user: loggedInUser(),
  date: today()},
  local!cart: rule!AS_Get_Cart(),
  local!carttest:{name: local!info.name, stock: local!info.quantity,
  price: local!info.price, quantity:1, total:null()},
  
 ...
 

            a!sectionLayout(
              label: loggedInUser(),
              contents: {
                a!sideBySideLayout(
                  items: {
                    a!sideBySideItem(
                      item: a!richTextDisplayField(
                        label: "Shipping Address:",
                        labelPosition: "ABOVE",
                        value: local!user.address
                      )
                    ),
                    a!sideBySideItem(
                      item: a!richTextDisplayField(
                        label: "Account's Balance",
                        labelPosition: "ABOVE",
                        value: "$" & local!user.balance
                      )
                    )
                  }
                ),
                a!sideBySideLayout(
                  items: {
                    a!sideBySideItem(
                      item: a!richTextDisplayField(
                        labelPosition: "COLLAPSED",
                        value: {
                          a!richTextIcon(
                            icon: "house-damage"
                          ),
                          " ",
                          a!richTextItem(
                            text: {
                              "Update Address"
                            },
                            link: a!dynamicLink(
                              label: "Dynamic Link",
                              saveInto: local!addingaddress
                            ),
                            style: {
                              "STRONG"
                            }
                          )
                        }
                      )
                    ),
                    a!sideBySideItem(
                      item: a!richTextDisplayField(
                        labelPosition: "COLLAPSED",
                        value: {
                          a!richTextIcon(
                            icon: "plus"
                          ),
                          " ",
                          a!richTextItem(
                            text: {
                              "Add Credits"
                            },
                            link: a!dynamicLink(
                              label: "Dynamic Link",
                              saveInto: local!addcredits
                            ),
                            style: {
                              "STRONG"
                            }
                          )
                        }
                      )
                    )
                  }
                ),
                a!sideBySideLayout(
                  items: {
                    a!sideBySideItem(
                      item: a!textField(
                        label: "Text",
                        labelPosition: "COLLAPSED",
                        placeholder: "Add New Address Here",
                        value: local!newaddress,
                        saveInto: local!newaddress,
                        refreshAfter: "UNFOCUS",
                        showWhen: local!addingaddress,
                        validations: {}
                      )
                    ),
                    a!sideBySideItem(
                      item: a!buttonArrayLayout(
                        buttons: {
                          a!buttonWidget(
                            label: "Update",
                            saveInto: {a!save(local!addingaddress, false()),
                            a!writeToDataStoreEntity(cons!AS_DataStore_Account_Pointer,local!changeaddress)
                            },
                            style: "NORMAL",
                            showWhen: local!addingaddress
                          )
                        },
                        align: "START"
                      )
                    ),
                    a!sideBySideItem(
                      item: a!textField(
                        label: "Text",
                        labelPosition: "COLLAPSED",
                        placeholder: "Place the Amount",
                        value: local!addedcredit,
                        saveInto: local!addedcredit,
                        refreshAfter: "UNFOCUS",
                        showWhen: local!addcredits,
                        validations: {}
                      )
                    ),
                    a!sideBySideItem(
                      item: a!buttonArrayLayout(
                        buttons: {
                          a!buttonWidget(
                            label: "Add",
                            saveInto: {a!save(local!addcredits,false()),
                            a!writeToDataStoreEntity(cons!AS_DataStore_Account_Pointer,local!changedbalance)
                            },
                            style: "NORMAL",
                            showWhen: local!addcredits
                          )
                        },
                        align: "START"
                      )
                    )
                  }
                )
              }
            )

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data