Is there a way to evaluate rule inputs of an interface as the interface is being called?

A Score Level 2

We have an interface with a rule input 'Validation' that passes whether field validations in the field are true or false. Is there a way to evaluate this rule input as the interface is being loaded/called? We're running into an issue where if an interface is called with pre-populated fields, the validation is not triggered because those fields already contain data. Our validations are only triggered after a user active enters values into a field. We want to evaluate validations as interface is being loaded so any pre-existing pre-populated fields are validated true/false. Any help is greatly appreciated!

  Discussion posts and replies are publicly visible

Parents
  • Hi

    You can set default test values in the rule inputs. This way every time you open the interface, it will load with the default values.

  • 0
    A Score Level 2
    in reply to ankitab0001

    But these default test values are for testing only, right? I'd like to know if its possible to calculate default values when the interface is called as a rule in another interface

  • 0
    A Score Level 2
    in reply to miked

    You need to give similar test values in the rule where you are calling from. For eg: rule!ABC has default test values in param1: "abc". You need to call this rule from rule!PQR. rule!abc(param1:"abc")

  • 0
    A Score Level 2
    in reply to ankitab0001

    I understand that I can call the interface in a parent interface and pass parameters, just like how you'd call a function. However my question is for evaluating values inside the child interface as its being called. An example below:

    Child interface has a text field with validation. When validated it will pass this value (true/false) into its rule input.

    Parent interface can call this child interface in two ways, one where the user has to enter a value in the text field and another where there is already a value prepopulated in the text field

    If the parent interface calls the child interface by way of a user entering a value in the text field, the validation will work as expected

    However, if the parent interface calls the child interface by way of prepopulated value in the text field, the validation is not triggered since it is only triggered by user input/keystroke

    Is there a way to evaluate in instances where the child interfaces has no user interaction when it normally does? i.e. trigger validation for text field if it is prepopulated with a value when child interface is initially called

  • 0
    A Score Level 2
    in reply to miked

    load(
      local!name,
      a!textField(
        label:"Test",
        value:"hello",
        saveInto: local!name,
        validations: if(local!name="hello","give a name","")
      )
    )

    Check this code for example. The validation will only work if local!name is "hello". The variable will only be populated where there is a user interaction on the text field. Even you pass a prepopulated value there is no way, the validation will work.

    Check the below code. Here the validation will work without the user interaction.

    load(
      local!name:"hello",
      a!textField(
        label:"Test",
        value:local!name,
        saveInto: local!name,
        validations: if(local!name="hello","give a name","")
      )
    )
    

Reply
  • 0
    A Score Level 2
    in reply to miked

    load(
      local!name,
      a!textField(
        label:"Test",
        value:"hello",
        saveInto: local!name,
        validations: if(local!name="hello","give a name","")
      )
    )

    Check this code for example. The validation will only work if local!name is "hello". The variable will only be populated where there is a user interaction on the text field. Even you pass a prepopulated value there is no way, the validation will work.

    Check the below code. Here the validation will work without the user interaction.

    load(
      local!name:"hello",
      a!textField(
        label:"Test",
        value:local!name,
        saveInto: local!name,
        validations: if(local!name="hello","give a name","")
      )
    )
    

Children
No Data