Using World Map \ Bing Map in SSRS Report in Dynamics 365 (and earlier)

Hi,

Recently I was working on a SSRS Report that will show the countries in the world map (Country was a custom entity in our CRM)

To create such a report, drag the Map report item to the report designer.

OOB we do not have world map in the Map Gallery.

Download it from the following location

https://mapgallery.codeplex.com/releases

Copy the download RDL to the following location (in my case – SQL Server Data Tools for VS 2012)

Select the world map

Add a Bing Map layer

Select Basic map

Click Next and select appropriate value

Click on Finish.

Next inside report designer, right click Layer Data

And specify mapping between the spatial and analytical dataset (our custom dataset here which has 2 column in it, name of the country and A2.

Suppose we have following countries in our CRM

The final report with countries highlighted in colors.

Hope it helps..

Advertisements

Validating Input Parameters in SSRS

We recently developed a report which had Days Input Parameter in it. Now the requirement was if the user enters any thing other then number (integer) over there they should get the appropriate error message.

Here if we define the Days parameter of type Integer and if we enter say for e.g. value = ‘x’ over there

We will get the following error message.

And if we upload the same report in the CRM, we will get the following error message, which doesn’t seem that user friendly.

Now to display proper error message to the end user we can take the following approach.

Change the parameter type to Text first. (From integer type)

Add a text box to report to show the error message, have following expression. If the value entered for Days parameter is not of numeric type display error message.

To hide the table if the Days field is not numeric, set the Hidden property with the following expression. If the Days parameter value is not numeric then hide the table.

And the following change in the DataSet’s query

Original Query

SELECT
Name, lss_First_Name, lss_Last_Name

FROM
Account

WHERE (DATEDIFF(day,CreatedOn,GETDATE())@Days)

New Query

If Days is not a numeric field then then modified select query to retrieve blank data from the table (using createdon field null criteria here in our case)

DECLARE
@SQL
Nvarchar(1000)

IF  ISNUMERIC(@Days)= 1 BEGIN

SET
@SQL ‘SELECT Name, lss_First_Name, lss_Last_Name FROM Account WHERE (DATEDIFF(day, CreatedOn, GETDATE())) >’+Convert(nvarchar,@Days)+

End

Else

Begin

SET @SQL=‘SELECT Name, lss_First_Name, lss_Last_Name FROM Account WHERE createdon=Null’

End

exec(@SQL)

The report with proper Days value for e.g. 1

If entered incorrect Days value for e.g. abc

Helpful post

http://geekswithblogs.net/Compudicted/archive/2012/08/14/validate-ssrs-report-input-parameters-the-proper-way.aspx

Hope it helps.