I want to return true as an output from the suggestion function if the entered code doesn’t match any existing ones, so I can use it as an output.

I'm encountering an issue where I need my suggestion function to return both a dataSubset and an output value (like a flag). The goal is to allow users to enter a new project code if it doesn't exist and make dependent fields editable. I need a way to pass that output from the rule back to the interface
 Trying with a!update

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    Need more details on the requirement but wrote a simple code to enable/disable dependent  fields based on user entered value . I am checking the entered value against data in my local variable you can optimize this with your real time data

    a!localVariables(
      local!existingCodes: { "ABC", "DEF", "GHI" },
      local!var1,
      local!isvar1present: a!refreshVariable(
        value: if(
          a!isNullOrEmpty(local!var1),
          false,
          contains(local!existingCodes, local!var1)
        )
      ),
      {
        a!cardLayout(
          contents: {
            a!textField(
              label: "Text",
              labelPosition: "ABOVE",
              value: local!var1,
              saveInto: { local!var1 },
              refreshAfter: "UNFOCUS",
              validations: {},
              instructions: if(local!isvar1present,"Entered Value is already present","")
            )
          },
          height: "AUTO",
          style: "TRANSPARENT",
          marginBelow: "STANDARD"
        ),
        a!textField(
          label: "Text",
          labelPosition: "ABOVE",
          saveInto: {},
          disabled: if(
            a!isNullOrEmpty(local!var1),
            true,
        local!isvar1present
          ),
          refreshAfter: "UNFOCUS",
          validations: {}
        ),
        a!textField(
          label: "Text",
          labelPosition: "ABOVE",
          saveInto: {},
          disabled: if(
            a!isNullOrEmpty(local!var1),
            true,
           local!isvar1present
          ),
          refreshAfter: "UNFOCUS",
          validations: {}
        ),
        a!textField(
          label: "Text",
          labelPosition: "ABOVE",
          saveInto: {},
          disabled: if(
            a!isNullOrEmpty(local!var1),
            true,
           local!isvar1present
          ),
          refreshAfter: "UNFOCUS",
          validations: {}
        )
      }
    )

Reply
  • 0
    Certified Senior Developer

    Need more details on the requirement but wrote a simple code to enable/disable dependent  fields based on user entered value . I am checking the entered value against data in my local variable you can optimize this with your real time data

    a!localVariables(
      local!existingCodes: { "ABC", "DEF", "GHI" },
      local!var1,
      local!isvar1present: a!refreshVariable(
        value: if(
          a!isNullOrEmpty(local!var1),
          false,
          contains(local!existingCodes, local!var1)
        )
      ),
      {
        a!cardLayout(
          contents: {
            a!textField(
              label: "Text",
              labelPosition: "ABOVE",
              value: local!var1,
              saveInto: { local!var1 },
              refreshAfter: "UNFOCUS",
              validations: {},
              instructions: if(local!isvar1present,"Entered Value is already present","")
            )
          },
          height: "AUTO",
          style: "TRANSPARENT",
          marginBelow: "STANDARD"
        ),
        a!textField(
          label: "Text",
          labelPosition: "ABOVE",
          saveInto: {},
          disabled: if(
            a!isNullOrEmpty(local!var1),
            true,
        local!isvar1present
          ),
          refreshAfter: "UNFOCUS",
          validations: {}
        ),
        a!textField(
          label: "Text",
          labelPosition: "ABOVE",
          saveInto: {},
          disabled: if(
            a!isNullOrEmpty(local!var1),
            true,
           local!isvar1present
          ),
          refreshAfter: "UNFOCUS",
          validations: {}
        ),
        a!textField(
          label: "Text",
          labelPosition: "ABOVE",
          saveInto: {},
          disabled: if(
            a!isNullOrEmpty(local!var1),
            true,
           local!isvar1present
          ),
          refreshAfter: "UNFOCUS",
          validations: {}
        )
      }
    )

Children
No Data