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)
choose()
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
Don't use choose() at all now. For anything. We have a!match() now.
does it work with an array of values? I don't think so
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.
Thanks, here it goes:
I have a tab interface where an index controls which content should be displayed. The content for each tab is stored in an array, and I need to show the content that matches the current index.
{ a!tagField( labelPosition: "COLLAPSED", tags: { a!tagItem( text: "TAG", backgroundColor: "ACCENT" ) } ), a!tagField( labelPosition: "COLLAPSED", tags: { a!tagItem( text: "TAG 2", backgroundColor: "NEGATIVE" ) } ), a!tagField( labelPosition: "COLLAPSED", tags: { a!tagItem( text: "TAG 3", backgroundColor: "POSITIVE" ) } ), }
What's the source of the available indexes, and where/how will the individual tab contents be configured?
it needs to be exactly that code, an interface code, which will be on different rules of course, it is supposed to be named like rule!BBP_TAG_1 for example. It is not my real example actually, however I believe I'll get some hint through it
If you're calling different sub-interfaces, then of course they'll need to be declared directly in the code for your parent interface. I'm still a little shaky as to what your overall configuration looks like, but i'm guessing you can configure something along these lines:
a!match( value: local!selectedTabIndex, equals: 1, then: rule!BBB_TAG_1(...), equals: 2, then: rule!BBB_TAG_2(...), [... etc], default: rule!default_tab() /* use for default or invalid selection, etc */ )
The issue is that the length should be dynamic, through parameters. The length of it can vary. But anyways, I am kinda pessimist about this being able to do that right now.
Silas. B. Ferreira said:The issue is that the length should be dynamic, through parameters
How do you plan to handle a dynamic length of tabs with a prescribed set of sub-interfaces? There isn't a way to dynamically generate (named) interfaces.
My component should be something like
{ /* Example 1 */ rule!App_TABS( tabs: { "TAB 1", "TAB 2", "TAB 3" }, contents: { rule!APP_content_1(), rule!APP_content_2(), rule!APP_content_3() } ), /* Example 2 */ rule!App_TABS( tabs: { "TAB 1", "TAB 2", "TAB 3", "TAB 4", "TAB 5" }, contents: { rule!APP_content_1(), rule!APP_content_2(), rule!APP_content_3(), rule!APP_content_4(), rule!APP_content_5(), } ) }
The reason is that I want it to become an utility rule.