Jun 25, 2014

Issue in setFocus in forms of CRM 2011

After spending some frustrating time I found a native CRM 2011 issue. When I try to set focus to a lookup field onload of form, it just doesnt work.

What I observed was it jumps to the expected field, but switches back to some other field in the top of the form in no time.

Then I found below fix.. thought of sharing here;

function onLoad() {
   window.setTimeout(focusFromField,100)
}

function focusFromField() {
  var _Control = Xrm.Page.ui.controls.get("new_officeid");
  _Control.setFocus();
}

Also learned this issue is fixed in CRM 2013.

Jun 17, 2014

Resolution for issue of wrong totals in tables grouped with filters in SSRS

Previous post I explained the fruit you can have by using filters when grouping table columns. Still, it can be frustrating if you need subtotals for any numeric values in table. What really happens is totals ignore the filters. (Just behave like there is no filter!)

Suppose we add group by some field, but only needs values for given two countries. (i.e. France and Belgium). Filter will be seen as below;


So we also need to get sub totals for groups (suppose, field name as revenueVal). So what we usually do is put below method in the total row;

SUM(revenueVal)

As I explained, issue is this will sum up all the revenues of all the countries not just for filtered ones.

This is the resolution.
Define another calculated field in the DataSet.


And add the same filter criteria as an expression;


Expression will be looked like this… hope you understand the simple logic. We are replacing zero for all the rows which do not meet the criteria.

* Note: If you are going to use the totals in Matrix (instead of a table) please use “nothing” instead of “0” in above expression.

Now we are using our own calculated field for calculation; 

SUM(revenueVal_Filtered)

Now this subtotal adheres our criteria.

Jun 16, 2014

Filter data of Table grouping in SSRS

Table grouping is one of the most frequently used techniques in SSRS reports in practice. They can be either easy or very complex. One cool thing we can do in grouping, is putting filters. Fruit is we can have groups for our desired records only.

Most cases we need to use two conditions together as “OR” or “AND” logical join.

This is a good example of using AND condition.
Logic here is Country is France AND Sector is Banking.


Now see the OR condition which is little tricky.
Logic here is Country is either France OR Belgium.


Caution: Using filters for grouping is fun, but there is a known issue of it, if you need to get totals of some numeric columns. Simply SUM() function ignores the filters. There is a workaround for this which I will explain in a later post.

Jun 9, 2014

Issue when passing same parameters to more than one data set in SSRS

In SSRS, it is allowed to pass same set of parameters to more than one DataSet which is great. Still it can drag you to troubles if you don’t do it correctly. Below is one error message you may hit with;

An error has occurred during report processing.
The Value expression for the query parameter XXXX contains an error. The expression that references the parameter XXXX does not exists in the Parameters collection. Letters in the name of  parameters must use the correct case.
 
I too encountered this and couldn’t solve for hours. Ultimately, I found this has nothing to do with anything else but the order of the parameters being read in the DataSets. Usually, one may not realise this since we assign it by name.. BUT NOT ENOUGH..  make the same order in all the DataSets using the arrow above..


hmm.. simple.

Caution: And if this error encountered, you may need to delete the parameters and set them again from the scratch.