Dynamic content block with two filters
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2023 07:20 AM
Are there any examples of Dynamic Content Blocks created as Interactive Filters, which have two separate filters i.e. on different tables but are triggered by a single action. Is that a thing?
For e.g. (Not the real one) Consider a dashboard with single score reports of Incidents Closed and RITMs Closed.
I need user to be Choosing a date in a dropdown and then both the reports on the dashboard follow the same filter.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2023 09:37 AM
Hi @Aditya Raute ,
Not sure if it is what you are looking for but you can broadcast different filters to different tables from the same Dynamic Content Blocks (created as Interactive Filters).
The key is, instead of using the my_dashboardMessageHandler.publishFilter() method:
my_dashboardMessageHandler.publishFilter(filter_message.table, filter_message.filter);
you have to use the my_dashboardMessageHandler.publishMessage() method:
my_dashboardMessageHandler.publishMessage(finalFilter);
As an example, imagine having 2 reports in the same dashboard, one based on the "Asset" table, the other one based on the "Asset Covered" table. You want one single filter on Asset's state that refreshes both reports automatically.
The code of your content block would look like:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<select id="state" name="state" onChange="selectState();">
<option value="1">New</option>
<option value="2">In Stock</option>
</select>
<script>
var my_dashboardMessageHandler = new DashboardMessageHandler("my_unique_id");
clearFilter();
function selectState() {
var stateSelected = document.getElementById("state");
var filterAsset = "install_status=" + stateSelected.value;
var filterAssetCovered = "asset.install_status=" + stateSelected.value;
var filter_message = {};
filter_message.id = "my_unique_id";
var finalFilter = [{"table":"alm_asset","filter":filterAsset},
{"table":"clm_m2m_contract_asset","filter":filterAssetCovered}];
SNC.canvas.interactiveFilters.setDefaultValue({
id: filter_message.id,
filters:finalFilter,
}, false);
my_dashboardMessageHandler.publishMessage(finalFilter);
}
function clearFilter () {
SNC.canvas.interactiveFilters.removeDefaultValue(my_dashboardMessageHandler._unique_id, false);
my_dashboardMessageHandler.removeFilter();
}
</script>
</j:jelly>
Hope it helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2025 01:31 AM
This should definitely be marked as solutions!
It works perfectly!
Regards,
Simone