Forum Discussion

irismaessen's avatar
irismaessen
Data Pipeline
06-22-2022
Solved

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, n...
  • harikm007's avatar
    06-23-2022

    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