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

    Either way you'll need to figure out a way to work within the system's constraints - mainly here that there isn't a supported way to call arbitrarily-named sub-interfaces (or other rules etc); whatever you want to use will need to be hardcoded into the parent interface.  You'll have a lot better time if you architect it in such a way that you can use a limited set of sub-interfaces and parameterize the contents using tab-specific data you pass in (as needed).

Children
  • I see, thank you and Harsha as well. I guess I will just componentize the tabs, and use a rule input to store the index back to the whichever main interface use the component, that should work like:

    /*ri!tabs: (Array of Text)*/
    /*ri!activeTab: (Integer store the active tab through index)*/
    
    a!localVariables(
      a!cardLayout(
        contents: {
          a!cardLayout(
            contents: {
              a!columnsLayout(
                columns: {
                  a!forEach(
                    ri!tabs,
                    a!columnLayout(
                      contents: {
                        a!cardLayout(
                          contents: {
                            a!richTextDisplayField(
                              labelPosition: "COLLAPSED",
                              value: {
                                char(10),
                                a!richTextItem(
                                  text: ri!tabs[fv!index],
                                  color: if(
                                    fv!index = ri!activeTab,
                                    "STANDARD",
                                    "ACCENT"
                                  ),
                                  size: "STANDARD",
                                  style: if(fv!index = ri!activeTab, "STRONG", "PLAIN")
                                ),
                                "  ",
                                a!richTextIcon(
                                  icon: "exclamation-triangle",
                                  showWhen: false,
                                  color: "NEGATIVE"
                                )
                              },
                              align: "CENTER"
                            ),
                            a!cardLayout(
                              style: if(fv!index = ri!activeTab, "ACCENT", "NONE"),
                              padding: "EVEN_LESS",
                              showBorder: false
                            )
                          },
                          link: a!dynamicLink(value: fv!index, saveInto: ri!activeTab),
                          padding: "NONE",
                          showBorder: false,
                          accessibilityText: if(
                            fv!index = ri!activeTab,
                            "Selected Tab.",
                            "Unselected Tab. Press enter to select tab."
                          )
                        )
                      },
                      width: "NARROW"
                    )
                  )
                },
                marginBelow: "NONE",
                spacing: "NONE"
              ),
              a!cardLayout(padding: "NONE")
            },
            padding: "NONE",
            showBorder: false
          ),
          
        },
        padding: "NONE",
        showBorder: false
      )
    )