Refine A Search Function

Certified Senior Developer

Good day,

I'd like to implement a search function in an interface, but I'm struggling to make it work. Once the user types in a search term and presses the search button, the appropriate results should return.

The code : 

a!localVariables(
local!search: false,
local!searchTerm,
local!searchTitles: {
"Amadori",
"Telpark",
"Microsystem",
"Kone"
},
local!searchData: a!dataSubset(
data: rule!JT_CONS_CASE_STUDIES(),
batchSize: - 1,
startIndex: 2,
sort: a!sortInfo(field: "title", ascending: true)
),
local!searchField: index(
local!searchTerm,
wherecontains(local!searchTitles, local!searchData)
),
{
a!sectionLayout(
label: "",
contents: {
rule!JT_uiCaseStudyDashboard(numberOfColumns: 3)
},
showWhen: local!search,
isCollapsible: true
),
a!sideBySideLayout(
items: {
a!sideBySideItem(
item: a!textField(
labelPosition: "COLLAPSED",
placeholder: "Search Use Cases",
value: local!searchTerm,
saveInto: local!searchTerm,
)
),
a!sideBySideItem(
item: a!buttonArrayLayout(
buttons: {
a!buttonWidget(
icon: "search",
value: rule!APP_safeIndex(
dictionary: rule!JT_CONS_CASE_STUDIES(),
path: "dictionary.title"
),
/* The save here would use local!searchTerm to perform the search */
saveInto: { a!save(local!search, not(local!search)) },
size: "SMALL",
style: "NORMAL",
accessibilityText: "Search"
)
},
marginBelow: "NONE"
),
width: "MINIMIZE"
)
},
alignVertical: "MIDDLE",
spacing: "DENSE"
)
}
)

The user needs to search according to title of this list of dictionary :

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data