Forum Discussion

sylvia_gulubova's avatar
sylvia_gulubova
Data Storage
11-27-2024
Solved

Date Filter -- allow users to only choose a value from list of days

How is it possible to limit user actions with date filters (like the one below) to only choose a value from list of days and nothing else (change the list format to months/years, use calendar, time f...
  • AssafHanina's avatar
    AssafHanina
    12-02-2024

    Hey sylvia_gulubova ,

    Date Filter allow different Granularities such as Years, Quarters, Months, Weeks and Days. 
    In Version L2024.1 the New UI Filters are enabled which provide different view as the screenshot shared which using the old filters UI/UX. 
    In both cases, using the Dependent filter will allow switching the Granularities which isn't sufficient in this case. 

    I would refer to the second option which is creating a blox drop down filter that allow a single select for Days.

    1. Create a Blox widget and Add the Date Column with Days granularity. Please find an Example.
    2. Add the Date as dashboard filter and Hide it 
     
     

    Blox Example

    {
        "showCarousel": true,
        "carouselAnimation": {
            "delay": 0,
            "showButtons": false
        },
        "body": [
            {
                "type": "Container",
                "style": {
                    "justify-items": "center",
                    "align-items": "center"
                },
                "items": [
                    {
                        "type": "TextBlock",
                        "spacing": "medium",
                        "size": "large",
                        "text": "Select date",
                        "style": {
                            "text-align": "center",
                            "font-weight": "600"
                        }
                    },
                    {
                        "type": "Container",
                        "spacing": "small",
                        "items": [
                            {
                                "type": "Input.ChoiceSet",
                                "id": "data.filters[0].filterJaql.members[0]",
                                "class": "",
                                "value": "PDAs",
                                "displayType": "compact",
                                "style": {
                                    "align-self": "center"
                                },
                                "choices": "{choices:Date}"
                            }
                        ]
                    }
                ]
            }
        ],
        "actions": [
            {
                "type": "Filters",
                "title": "Filter!",
                "data": {
                    "filters": [
                        {
                            "panelName": "Date",
                            "filterJaql": {
                                "explicit": true,
                                "members": [
                                    ""
                                ]
                            }
                        }
                    ]
                }
            },
            {
                "type": "Filters",
                "title": "Clear",
                "data": {
                    "filters": [
                        {
                            "panelName": "Date",
                            "filterJaql": {
                                "explicit": true,
                                "all": true
                            }
                        }
                    ]
                }
            }
        ]
    }

    Best Regards