Add an interactive filter based on a field from a referenced table

adilbelahbib
Kilo Expert

Hey,

I have created a report on the alm_asset table (a Multilevel Pivot report). the report show the different quantities of assets by product model and by stockroom.

by default, I have as filters the different fields that I chose as rows/columns, but now I need to add some other filters such as product model status.

I found that I can use Interactive filters to add customized filters, but all I can do is to choose a table and a field from that same table, and not from a referenced field (Asset.Product_model.status).

Any ideas how can I filter assets based on a field that exists in the referenced table 'Product Model' ?

Thank you !

1 ACCEPTED SOLUTION

Adil,



I'm sorry I missed that you were trying to use interactive filters.   In your case you may have to build a custom interactive filter.


Custom interactive filter example



Here is a simple example (modified from the example linked about) to toggle all assets and just in production assets:


<?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");


</script>


Example of a filter for alm_asset.model.status = In Production


<input id="allAssets" type="button" value="All Assets" onclick="my_dashboardMessageHandler.removeFilter();" />


<input id="prodAssets" type="button" value="Only In Production Assets" onclick="my_dashboardMessageHandler.publishFilter('alm_asset','model.status=In Production');" />


</j:jelly>



Thanks


Brian


View solution in original post

5 REPLIES 5

brian_quinn
ServiceNow Employee
ServiceNow Employee

Adil,



In the dropdown where you select the field, the very last entry should say "Show Related Fields".   Once you select that, you can reopen the drop down menu and you should now be able to select "Model => Product Model fields".   Finally you can select the status field.



Capture.PNGcapture2.PNG capture3.PNG



Hope this helps.



Thanks


Brian


Hi Brian,


Thanks for the answer.


In the drop down menu, I can't find the "Show Related Fields" option (as you can see in the screenshot below). I want to be able to get the assets by theire Model status, for example the quantities of assets from models where status is 'In stock'



find_real_file.png


Hi Adil,



For 'Show Related List' option, follow the below screenshot:



reference.png



Thanks,


Vipul Gupta


Thank you Vipel for the answer. But I want to give the user the ability to filter based on the status, not build the whole report based on it.