- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2023 03:24 AM
Hi All,
I have added a List report on the Dashboard with source as catalog task table. I want to apply the interactive filter to this dashboard using Content Block widget.
On this widget, I have added 2 date_time fields to pick the date/time with one button to call the below function
When i am passing the two static date/time values (between) to the publish filter, dashboard return the result correctly. But i would like to use the date value entered on the form in 2 fields and pass to this function.
I have tried to use below but it is not working and returns no data.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2023 12:54 AM
Hi,
Try this code and confirm if this works fine
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<script>
var my_dashboardMessageHandler = new DashboardMessageHandler("my_unique_id");
function publishFilter () {
var filter_message = {};
filter_message.id = "my_unique_id";
filter_message.table = "sc_task";
var startdatetime = document.getElementById('DateTime1').value;
var enddatetime = document.getElementById('DateTime2').value;
var startdate = startdatetime.split(" ")[0];
var startdate_format = startdate.split("-")[2] + "-" + startdate.split("-")[0] + "-" + startdate.split("-")[1]
var starttime = startdatetime.split(" ")[1];
var enddate = enddatetime.split(" ")[0];
var enddate_format = enddate.split("-")[2] + "-" + enddate.split("-")[0] + "-" + enddate.split("-")[1]
var endtime = enddatetime.split(" ")[1];
<!-- Add your own filter query logic here -->
filter_message.filter = "opened_atBETWEENjavascript:gs.dateGenerate('" + startdate_format + "','" + starttime + "')@javascript:gs.dateGenerate('" + enddate_format + "','" + endtime + "')";
SNC.canvas.interactiveFilters.setDefaultValue({
id: filter_message.id,
filters: [filter_message]
}, false);
my_dashboardMessageHandler.publishFilter(filter_message.table, filter_message.filter);
}
Palani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2023 05:37 AM
Thanks @palanikumar . Solution has worked and able to filter based on the dynamic date/time values selected on the page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2024 04:33 AM - edited 01-07-2024 11:50 PM
Very Helpful thanks!