Passing Expressions as Expression Parameters

Certified Lead Developer

Are there any plans to allow for the passing expressions as expression parameters? I think this would be an incredibly useful feature to add to the expression language.

  Discussion posts and replies are publicly visible

Parents
  • You can pass expression rule references via Any Type parameters. For instance, in the below example, we control the transformation function that is used to change a local variable when a button is clicked. When the first button is pressed, the value will have the logarithm with base 5 taken. When the first button is pressed, the value with be taken to the 5th power. This works with any expression rule in addition to functions.

    Make a button widget rule called myButtonWidget with inputs ri!value and ri!transformFunction with the following code:

    a!buttonWidget(

     label: "Transform Value",

     saveInto: a!save(ri!value, ri!transformRule(ri!value))

    )

    Then, in an interface, call this rule twice with different transformation functions:

    load(

      local!value: 10,

    a!buttonLayout(

     primaryButtons: {

       rule!myButtonWidget(local!value, log(_, 5)),

       rule!myButtonWidget(local!value, power(_, 5))

    }

    )

    )

  • Ah, it looks like you figured it out on your own!
Reply Children