a!save() and saveInto()

anybody can explain a!save() and saveInto() some little more depth

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    saveInto is generally a parameter used in user-interactive components that collects an array of save targets to receive the new value entered into that component by a user.  It's not a function hence no "()".

    a!save() is a rule which can be added to within the saveInto list of pretty much any component, allowing incredibly increased functionality by allowing a user to save arbitrary values into arbitrary different variables, including but not limited to a transformed version of the incoming value from the component.

    Here is an example of an a!textField() component that uses a generic save as well as an a!save() inside its saveInto.  I suggest you create a similar interface and play around with it some to really explore how this functionality works.

    load(
      local!textValue: "initial value",
    
      local!textUpdated: false(),
    
      a!textField(
        label: "Test Text",
        instructions: if(local!textUpdated, "(Updated)", ""),
        value: local!textValue,
        saveInto: {
          local!textValue,
          a!save(
            local!textUpdated,
            true()
          )
        }
      )
    )

Reply
  • 0
    Certified Lead Developer

    saveInto is generally a parameter used in user-interactive components that collects an array of save targets to receive the new value entered into that component by a user.  It's not a function hence no "()".

    a!save() is a rule which can be added to within the saveInto list of pretty much any component, allowing incredibly increased functionality by allowing a user to save arbitrary values into arbitrary different variables, including but not limited to a transformed version of the incoming value from the component.

    Here is an example of an a!textField() component that uses a generic save as well as an a!save() inside its saveInto.  I suggest you create a similar interface and play around with it some to really explore how this functionality works.

    load(
      local!textValue: "initial value",
    
      local!textUpdated: false(),
    
      a!textField(
        label: "Test Text",
        instructions: if(local!textUpdated, "(Updated)", ""),
        value: local!textValue,
        saveInto: {
          local!textValue,
          a!save(
            local!textUpdated,
            true()
          )
        }
      )
    )

Children
No Data