choose function usage with rule inputs as parameters.

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.

  Discussion posts and replies are publicly visible

Parents Reply
  • +1
    Certified Lead Developer
    in reply to Silas. B. Ferreira

    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"
      )
    )

Children