DBI Cheats

Thank you Kris, Thats good to know:)

If you have a Hierarchy that is using a direct drag and drop of a Data Connector but you realize that you have more data there then you need there is a way to alter the auto generated Data Cube that obvious (in 2.6 at least).

In the Explore panel you can drill down into dashboards and view the Auto-Generated Items (Metric Sets) and promote them to full-blown Metric Sets, but there isn’t an analog in the Explore window for Hierarchies. You can drill down to see the layers of the Hierarchy but you can’t do much with them.

I stumbled upon how to get there today: Use the Search Files control in the Explore panel and type in the name of the Data Connector you are using in the Hierarchy, you should see the original object but then you will also see the Data Cube icons with the name of the original object and a 1 appended. If you are using the same object in multiple hierarchies there will be multiple listed but you can view the properties of the object to see which one the hierarchy you are working on is using. Once you have it, open it up and you can set filters or even replace the guts with a manual query just like a regular Data Cube. Don’t bother checking it in after your data preview; just go to the Hierarchy and boom! there is your revised list.

These are all great tips. I don't have any of my own, just enjoying this page.

There is a way to switch between the top n and all the data points. Create a chart with measure and a button. Copy the following script on the Click interaction of the button and change the IDs of the chart, the top and bottom values and the name of the chart. We have got this script of Dundas and we would share this with alll other Dundas users.

var overrides = window.dundas.context.baseViewService.currentView.control.overrides.metricSetBindingOverrides

//put here the Id of your chart or table
var adapterId = ‘ec4ac6ee-b91c-676f-afd2-f0b67cc4c079’;
var adapter = window.dundas.context.baseViewService.currentView.getAdapterById(adapterId);
//in your case this is 10
var top_value = 10;
//in your case this is 0
var bottom_value = 0;
//put here the measure that the top values should be calculated from (measure on you chart)
var measure = ‘LineTotal’

//checks if the override already exists
if (overrides.filter(function(item){return item.uniqueName ===‘TopValueShown’})[0] === undefined ){

//if not a new override request is created
var override = {
“adapterId”: adapterId,
“metricSetBindingId”: adapter.metricSetBindings[0].id,
“requestOverrides”: new dundas.data.RequestOverrides(),
“uniqueName”: ‘TopValueShown’
};

//the override request gets added to the existing overrides
overrides.push(override);

//the override request is further defined as a top bottom override and the measure, top and bottom value are added
override.requestOverrides.topBottomOverrides = new dundas.data.TopBottomOverrides({
“measureUniqueName”: measure,
“topRecords”: top_value,
“bottomRecords”: bottom_value
});
}

//if the override already exists it is removed so the chart shows all values again
else {
var currentOverride = overrides.filter(function(item){return item.uniqueName ===‘TopValueShown’})[0]
var index = overrides.indexOf(currentOverride)
overrides.splice(index, 1);
}

//the chart has to reload for the changes to be visible
adapter.loadData();

Just a brief note about the use of window.dundas.context:


// This technique of getting the base view service has been deprecated

// due to changes made in the viewer.

// Calling window.dundas.context will cause problems when embedding.

// Post 2.6, we no longer suggest calling window.dundas.context.* for anything.

var baseViewServiceDeprecated = window.dundas.context.baseViewService;


// Instead we will call the following to get the service.

var baseViewService = this.getService("BaseViewService");


Note: This code would have been called from a button click.

Thanks everyone for all of the helpful tips and tricks!

These cheats are great.

To add my own, I needed to programatically pull data from a metric set in order to populate a dynamically generated object. The difficulty is, pulling the results using any obvious means yields a paged result which is no good, so here was the solution:


I started by hiding a table on the dashboard and hooked it to a filter so I could filter the result list. After that, the nice folks at Dundas helped me with this code:


- Create a new script on the Ready event of the Dashboard
- Next, add the following code snippet:

//gloabal variable we will save the unpaged cellset

datawindow.CellSet = [];

var myView = window. dundas.context .baseViewService. currentView;

var myTable = myView. getAdapters().toEnumerable ().first( function(a) {

//note: rename table3 to the script name of your of datagrid

return a.name === "table3";

});

var dataRetrievalService = window.dundas.context.getService ("DataRetrievalService" );

var pagingOption = new dundas .data. ResultPaging({ pagingKind: "None"});
var request = new dundas .data. Request({

objectId: myTable .metricSetBindings[ 0].metricSetId,

pagingOptions: pagingOption ,

viewId: myView .id

});
var def = dataRetrievalService.getData(request );

def.done(function (data) { CellSet = data [0 ].cellset;});
- Results: CellSet contains the unpaged rows

dataCellSet.rows.forEach( function (row) {

//your code


We do the same thing, Jason. Except we pass in the parameter value(s) to a function that executes the data retrieval and returns a promise with the filtered dataresult. Good example!

Here's another cheat from our Solutions Architect - it was posted in a separate discussion, so I'm moving it here so all the cheats are together!

How to Create Scrolling Marquee or Scrolling News Feed WITHOUT SCRIPTING


  • Drop a DataLabel on the dashboard and bind it to the text that you would like to have displayed in a marquee.
  • Click on the DataLabel and go to properties > Text
  • Modify the “text” property in order to wrap an HTML5 marquee tag like this. <marquee><b>[Product]</b></marquee> (feel free to add any formatting that you’d like to include)
  • In the properties panel to go Properties > Look and enable “Allow HTML Formatting”. This is the magic property!


How about a custom bootstrap nav menu on your dashboard?


The first problem is that including bootstrap will inevitably conflict with some of the built in Dundas BI classes. The solution is to namespace bootstrap. The best way is to simply use something like LESS an do something like


.customcss-bootstrap {
  @import (less) "bootstrap.css";
}


Once you compile this into CSS using LESS (or SASS, your choice), bootstrap will only take effect on items wrapped in a div with the class 'customcss-bootstrap'


Then, since I use this on almost every dashboard, I included my new custom bootstrap CSS file using the Dundas BI style.override:


@import url("bootstrapcustom.css");


Also, copy the bootstrap javascript file to your Scripts/Override/ folder.


Now, back to the dashboard..


Loading event:

if ($("#myNav").length == 0) {

$.getScript("../Scripts/Override/bootstrap.min.js", scriptFinishedLoading());

function scriptFinishedLoading() {
var body = $("#body");
body.prepend("<div id="myNav" class="customcss-bootstrap" ></div>");

var content = "<nav class="navbar navbar-inverse"> <!--insert your favorite bootstrap menu code here --> </nav>";

$("#myNav").append(content);


//your other code here -- click handlers, etc
}

}




Now you can have a bootstrap mobile responsive menu for your dashboards.





Image title





Tom, you should be able to do that using a calculated element:

int a = $[Measures].[InternetGross Profit]$;
int hours = a / 3600;
int minutes = (a% 3600) / 60;
int seconds = (a% 3600) % 60;
return string.Format("{0}:{1}:{2}",hours,minutes,seconds);

Good day to all of you!


Here is another tip that I got from the Dundas Bi Support team that is going to be very useful for our team moving forward.


The problem that we were running into was that we wanted to give the user the ability to show or hide data point labels on a graph by checking or unchecking a checkbox. When we reached out to support with this request they let us know the following:


There is no direct property that sets the visibility of the data point labels, however you can change the data label text to blank to “hide” the labels. To display the labels, you can set the text with a placeholder which is the Unique Name of your measure.

<!--[if !vml]--><!--[endif]-->


Here is a sample script that you can test on your checkbox’s click action:

if (checkbox1.control.value)

{

myChart.control.series[0].labels[0].text="[OrderDate]";

}

else

{

myChart.control.series[0].labels[0].text = "";

}

myChart.control.invalidate();


Nice and simple... another one of those that our team went "We should have thought of that!" and are happy to have added it to our cheat sheet.


Have a great day everyone!


Tom

I was experimenting with GreenSock javascript animation library and found out that I could utilize it in dashboards.


HTML Label Text

<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.19.0/TweenMax.min.js"></script>

Script on Button Click

TweenMax.to(chart1, 2, {width:"200px", height:"150px", left:"200px", repeat:3, yoyo:true});



That is good idea that I can share with my staff

Thanks!

Most of the work that we need to do can be done within the UI, but sometimes there are exceptions so it is great to use the cheat sheet :D

Here's a simple but powerful trick (that I can't take credit for)...


...handy when using a single data cube for multiple controls on a dashboard that includes a calendar filter. When creating the data cube, add this 'IsFuture' calculated element:

if ($[Your Date]$ < DateTime.Now) { return false;}else { return true;}


If I'm creating a metric set to show year-to-date data, I include this element as a slicer and filter for false; for a metric set showing remaining year data, include this element as a slicer and filter for true. By using this calculated element, the users can muck around with the calendar filter to their heart's content.




How you can have full screen for Dundas BI on iPAD so you get the experience of native application on it?

you can acheive that by doing the following steps

1. Edit javascript.override.js file and put inside it the following lines:

$('head').append('<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">');
$('head').append('<meta name="apple-mobile-web-app-title" content="Full Screen">');
$('head').append('<meta name="apple-mobile-web-app-status-bar-style" content="default">');
$('head').append('<meta name="apple-mobile-web-app-capable" content="yes">');


2. restart IIS or the Dundas application pool.

3. Open Safari, and lunch your Dundas BI http link.

4. follow the steps in this link (http://www.ianswerguy.com/add-website-icon-to-home-screen/) to create a short cut for Dundas BI on your home screen.

5. now you can access Dundas BI in full screen mode by opening Dundas BI though the new added icon.


That's a great trick...

Hello to all of you once again!


If you have your own map resources that you want to include in Dundas BI consider running them through mapshaper.org first to reduce their size. Playing around with the settings at this site you can balance the quality of the map structures against the size of the resulting file. Smaller files that still contain "enough" detail make maps load quicker in Dundas BI.


Have a fantastic day everyone!

Tom

nice one