Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
6 replies
Subscribers
7 subscribers
Views
2587 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
User Interface
I would like to use a!applyComponents to dynamically generate Sail components fo
jamesm90
over 9 years ago
I would like to use a!applyComponents to dynamically generate Sail components for a section layout. To simplify the problem, I've broken it down to just basic Sail components for testing. As we all know, this works fine:
a!sectionLayout(
firstColumnContents: {
a!textField(
label: "TEST1",
readOnly: true
),
a!textField(
label: "TEST2",
readOnly: true
)
}
)
But I want to have multiple Test1 and Test2 text boxes based off some array inside this section, so I wrap my text components up in a rule, and try this:
a!sectionLayout(
firstColumnContents: {
a!applyComponents(
rule!SubReviewTest(x:_),
{1,2}
)
}
)
Where SubReviewTest is:
{
a!textField(
label: "TEST 1 " & ri!x,
readOnly: true
),
a!textField(
label: "TEST 2 " & ri!x,
readOnly: true
)
}
The interface errors out with: "Unexpected error in ColumnLayout. Its configuration may be invalid." If I use section layout to grou...
OriginalPostID-156944
OriginalPostID-156944
Discussion posts and replies are publicly visible
0
jamesm90
over 9 years ago
...p the two text field inside of the rule SubReviewTest, then it works fine, but I want to be able to collapse one section that encloses all text fields created with the applyComponents.
In short, I need help developing a good working solution where I can add variable amounts of set Sail Components into a collapsible section layout.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Josh
Certified Lead Developer
over 9 years ago
You should not need to specify both text fields in the sub rule, you should only need to specify the one SAIL component, and create many copies of the one SAIL component using a!applycomponents().
Try defining your sub rule as the following:
a!textField(
label: "TEST "&ri!x,
readOnly: true
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
jamesm90
over 9 years ago
In application, I would be using two different types of Sail Components, such as Text, than Radio, I only used two text here for simplicity. So in the end I would like something such as:
TextField
RadioField
ImageField
Repeated as many times as elements in my array. So for array {1,2,3}:
TextField
RadioField
ImageField
TextField
RadioField
ImageField
TextField
RadioField
ImageField
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Josh
Certified Lead Developer
over 9 years ago
This is most likely because apply components returns a list of lists, which will not work inside firstColumnContents. This may require a bit of tweaking on your end, but this should provide a good jumping off point:
change your applyComponents line to:
reduce(fn!append, {}, a!applyComponents(function: rule!subreviewTest(_), array: {1,2}))
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
jamesm90
over 9 years ago
Thank you joshl! This was perfect, and you've taught me quite a bit :D
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Josh
Certified Lead Developer
over 9 years ago
glad to help!
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel