Reputation: 656
Here is my enum model:
enum (Station) {
description (List of station in Bart Schedule)
symbol (12th St. Oakland City Center)
symbol (16th St. Mission)
}
I am trying to display the above enum model in select box value but its not reflecting.
input-view{
match: Station(Station)
message(Where would you like to board from?)
render{
// auto-complete
selection-of (Station){
where-each (Station) {
single-line{
text{
value{
template ("#{value(Station)}")
}
}
}
}
}
}
}
Please let me know what i am doing wrong? Thanks in advance..
Upvotes: 0
Views: 223
Reputation: 1501
Here is one way to do it:
Define a default-init in action and supply it with selection value. The render block won't automatically display all possible enum values. Download this sample capsule at Github.
action (ActionDisplayGrade) {
description (__DESCRIPTION__)
type (Search)
collect {
input (grade) {
type (EnumGrade)
min (Required) max (One)
default-init {
intent {
goal: ActionGetAllEnumGrade
}
}
}
}
output (TypeTxt)
}
Please also note, your input-view code might work, but the style is NOT recommended. There are Three definitions of Station in your code, and each replace previous definition. It's better to code it this way:
input-view{
match: Station(this)
message(Where would you like to board from?)
render{
// auto-complete
selection-of (this){
where-each (item) {
single-line{
text{
value{
template ("#{value(item)}")
}
}
}
}
}
}
}
Upvotes: 1