irismaessen
06-22-2022Data Pipeline
How do I pass the content of a text Input to a Blox filter?
I'm trying to create a slightly more restrictive text filter using Blox. I want my users to be able to type in a search term to filter on, but I only want them to be able to do a 'contains' filter, not the other free text filter options.
I've managed to get an inputbox that gathers text, and a button that applies a 'contains' filter. What I have not yet managed is to pass information from one to the other. I'm fairly new to BloX, so I'm probably missing something obvious
Snippet of what I've got so far -- this just filters the dashboards to values containing the literal string {New Input.textVal}
{
"style": "",
"script": "",
"title": "",
"showCarousel": true,
"carouselAnimation": {
"delay": 0,
"showButtons": false
},
"body": [
{
"type": "Container",
"items": [
{
"type": "ColumnSet",
"columns": [
{
"type": "TextBlock",
"horizontalAlignment": "center",
"verticalContentAlignment": "center",
"wrap": true,
"text": "Search Text",
"spacing": "small"
},
{
"type": "Container",
"items": [
{
"type": "Input.Text",
"id": "textVal",
"class": "",
"title": "New Input",
"placeholder": "Your Search Term",
}
]
}
]
}
]
}
],
"actions": [
{
"type": "Filters",
"title": "Filter (by Dimension)",
"data": {
"filters": [
{
"filterJaql": {
"contains": "{New Input.textVal}"
},
"dim": {
"title": "Search",
"table": "myTable",
"column": "myColumn",
"datatype": "text"
}
}
]
}
}
]
}
Hi irismaessen ,
Try this blox script (update table and column name in script):
{ "style": "", "script": "", "title": "", "showCarousel": true, "carouselAnimation": { "delay": 0, "showButtons": false }, "body": [ { "type": "Container", "items": [ { "type": "ColumnSet", "columns": [ { "type": "TextBlock", "horizontalAlignment": "center", "verticalContentAlignment": "center", "wrap": true, "text": "Search Text", "spacing": "small" }, { "type": "Container", "items": [ { "type": "Input.Text", "id": "data.filters[0].filterJaql.contains", "class": "", "title": "New Input", "placeholder": "Your Search Term" } ] } ] } ] } ], "actions": [ { "type": "Filters", "title": "Filter (by Dimension)", "data": { "filters": [ { "filterJaql": { "contains": "" }, "dim": { "title": "Search", "table": "Records", "column": "Region", "datatype": "text" } } ] } } ] }
-Hari