Improve the User Experience for Production Dashboards (Video Tip)

This feature might be for you if you are building dashboards/reporting for a manufacturing or shift work setting. In manufacturing, you often have several shifts, and it’s a common requirement for ‘smart filtering’ to quickly and easily allow users to select only data from a particular shift on a dashboard. To solve this problem in Dundas BI, we use ‘custom tokens’ to retrieve data for only a specific shift on your dashboard. As the dashboard developer, you make the token once, and all your users can benefit from it.

Here is a walkthrough:

My script from the video:
DateTime[] dates = new DateTime[2];

//Get the start of today at 12:00AM
DateTime today = DateTime.Today.Date;            

//Start today at 8am
dates[0] = new DateTime(today.Year, today.Month, today.Day, 8, 0, 0);

//End today at 4pm
dates[1] = new DateTime(today.Year, today.Month, today.Day, 16, 0, 0);

//return date range;
return dates;

Other great resources for this topic:
https://www.dundas.com/resources/off-the-charts-tips-from-an-expert/elevate-your-dashboards-reports/use-tokens-to-make-your-dashboards-smart

https://www.dundas.com/resources/off-the-charts-tips-from-an-expert/getting-started-with-dundas-bi/how-to-create-custom-tokens-dundas-bi

https://www.dundas.com/support/learning/documentation/create-view-content/filters/creating-custom-tokens

****If you’re interested in the Visual Studio Code application that I use for debugging the C# code, this is a great video to help you get set up.
Here:https://channel9.msdn.com/Blogs/dotnet/Get-started-VSCode-Csharp-NET-Core-Windows

4 Likes

There is a full sample here if you’d like to play with this concept. I have also added some buttons that script the selection of these tokens.

3 Likes

Great stuff thanks Jeff!

My pleasure, @patrick. Appreciate the feedback.

Thanks Jeff, nice Tip

ahh!! this demo is exactly what I’m looking for, but I can’t get in to see the code behind those buttons. How can I get to it?

EDIT: so after I asked, I remembered that you often put debugger; in your button scripts, so I tried the console. Got it. Now I just need to extract the json and I should have it.

Hi Ken - remember the JSON trick from this video? That’s how I did it.

Here is the code behind the first button - the others are basically the same.

var viewParameter = this.parentView.control.getViewParameterByName("viewParameter1");
var token = "{\"__classType\":\"dundas.data.ParameterToken\",\"id\":\"b3eabc35-daa6-41c6-9950-9091c3f49163\",\"caption\":\"\\\"A\\\" Shift Today\",\"offset\":0,\"displayType\":\"RangeFull\",\"dataType\":\"Date\",\"isResolvable\":true,\"isOffsetSupported\":false,\"isInversionSupported\":true,\"category\":\"Script\"}";
viewParameter.parameterValue.token = JSON.parse(token);
viewParameter.refreshAllAdapters();
1 Like