Skip to main content
May 12, 2025
Solved

choose function usage with rule inputs as parameters.

  • May 12, 2025
  • 18 replies
  • 0 views

Hello, mates!

I would like to create a rule that will provide choices/options through parameters to be used with the choose() function (https://docs.appian.com/suite/help/25.1/fnc_logical_choose.html)

However, the choices will not have a default length. I tried using Appian array, but as expected, it didn't work because choose() expects individual parameters, not an array.

I'm working on creating a tab interface component, where the number of tabs isn't fixed, hence the need for dynamic choices.

Does anyone have any hint on this? Thanks.

Best answer by harshas2775

You need to figure out at most how many tabs can be there when either all conditions are passed or none applied.

If you can have at most 7 tabs then your match() needs to be configured with all 7 possibilities. Assign one unique index to each tab so that if dynamically only 4 tabs (e.g. Tabs 1,3,4 and 7) are selected, the indexes replicate the same.

If it easier you can also go with strings to match the selected tab with content instead of index. 

a!localVariables(
  local!selectedTab: "Tab2",
  a!match(
    value: local!selectedTab,
    equals: "Tab1",
    then: a!stampField(
      labelPosition: "COLLAPSED",
      icon: "angle-down",
      contentColor: "STANDARD"
    ),
    equals: "Tab2",
    then: a!stampField(
      labelPosition: "COLLAPSED",
      icon: "angle-up",
      contentColor: "STANDARD"
    ),
    equals: "Tab3",
    then: a!stampField(
      labelPosition: "COLLAPSED",
      icon: "angle-double-up",
      contentColor: "STANDARD",
      backgroundColor: "NEGATIVE"
    ),
    default: "No Priority"
  )
)

18 replies

mikes0011
Brainy
May 12, 2025

Don't use choose() at all now.  For anything.  We have a!match() now.

May 12, 2025

does it work with an array of values? I don't think so

mikes0011
Brainy
May 12, 2025

It works with anything you want.  I'd be happy to help you through a realistic example if you want, but you'll need to provide some sample code / sample data / screenshots / etc, just something more than a vague description.