Thursday, June 6, 2013

How to install Anslysis Service, Tabular Mode

During the installation of SQL Server 2012, there is step to select your Analysis service mode. you can only select one of those modes, Tabular or Multidimensional mode, in specific SQL Server instance.

Note that, Tabular mode is not available in other SQL Server versions. Its only in 2012.

You can create new instance of SQL Server to install Analysis Service, Tabular Mode:



Enjoy Analyzing.

SSAS Tabular Mode Error: The Workspace Database Server 'localhost' Is Not Running In Tabular Mode

when you try to create new tabular model or multidimensional model using SSDT. You may face this error:
"the workspace database server 'localhost' is not running in tabular mode" when you try to connect to local host analysis server.

to solve this error, make sure you already install analysis service + make sure to connect with correct workspace server, if its not 'localhost'. Final solution, try to connect with localhost\SqlServerInstanceName because analysis service takes default sql instance name in installation step.

Monday, April 29, 2013

How To Localize Asp.Net Page Title

As we know, we use GetLocalResourceObject("ResourceName") to get local resource value from local resource file.
Or GetGlobalResourceObject("FileName", "Key") to get resource from global resource file.

In order to localize asp.net page title we should use meta:resourceKey like the following:
<%@ Page meta:resourcekey="PageTitle" %>
and in the resource file, we set PageTitle.Title to access Title value in the page.
and we cann't use GetLocalResourceObject("ResourceName") or GetGlobalResourceObject("FileName", "key") to localize page title in HTML, but you can use it in Code behinde.

Thursday, April 25, 2013

How to remove last character from string in C#

Suppose you have the following sentence:
"Riyadh - Jeddah - Dammam -"
which comes from list of cities and separated by (-) after each city.
you need to remove last separator.

just use the following code:

// remove last separator
 if (lblInputRegions.Text.EndsWith("-"))
         lblInputRegions.Text = lblInputRegions.Text.Remove((lblInputRegions.Text.Length - 1), 1);

Friday, February 1, 2013

SSRS - Working With Map Control (1)

In this article, I will explain how we can use MAP control in SSRS.

MAP controls is new control added in new version of SSRS. You can present maps of the world, country, buildings, areas, roads ... etc.

I'm going to separate this article to multiple parts.

In this part, I'm going to show you how to use SSDT and create new SSRS project. Then, we will move to MAP control and describe its features and usage.

If you download SQL Server 2012, SSDT (SQL Server Data Tools) and Visual Studio 2010 will installed in your machine automatically.
If not installed, you can download it and install it in your machine
through this link: Click Me and for more information about versions and installation read this: Click Me

Now, open SSDT:


From File menu, create new project and set solution name "TestingMaps_SSRS", for example.


Create new report without data source, then drag and drop MAP control from Toolbox menu:


Now see the first window of the configuration:


Let me explain how map works, the first option is default option which shows MAP for USA.
you can select USA by state, USA by state exploded and USA by state inset.
In addition you can select specific state map for USA under States by Country folder.
The different between them is the data. I mean the map, the information of state ...etc.

The second option is ESRI shapefile. its file shows information about selected map.
for example you can download ESRI shapefile for KSA which shows KSA map, administrative areas, area codes, area phone code .... etc.

But the question is, where can I find the ESRI file?
There are a lot of sites provide ESRI files for FREE! and the following some of them:
- www.diva-gis.org
- www.vdstech.com
- www.gadm.org

The last option is from SQL Special Query. which means ESRI file inserted in SQL table.

In this part in may article, we will focus the first option.

Select "USA by state exploded" then press Next button:


In the second screen, you can change map appearance, quality and connect your map with Microsoft Bing Maps:



The third screen shows map visualization. You can select Basic Map, Color Analytical  Map or Bubble Map.

The Basic Map shows map as it is.
Color and Bubble maps should be connected with analysis service or data source to describe more data.
For example, State be Sales, State by Census, State by Customers ... etc.

We will select Basic Map:


The last screen select map theme. there are multiple themes select your favorite one.
There is check box called "Display Labels" check it and select "#STUSPS" from data field drop down list.
The "#STUSPS" will display state name shortcut in the map.
Press Finish and browse the report, you will see the following result:



Finally, you can change MAP TITLE from map properties.

Saturday, January 26, 2013

SSRS - Presenting Dynamic Images From Database To Report

I will explain how to represent images stored in SQL DB into report.

I expected you already save image in SQL DB as varbinary.



STEP -1
Create project SSRS project.


STEP -2
Create shared data source and report.

STEP -3
Create data source and select your image binaries, I supposed the image binary column named FileContent.






STEP -4
Now, in report body, add new table then add new image from toolbox in the first second row of the table and set the following properties:


Then press OK. The result will be like the following:



Tuesday, January 1, 2013

SSRS - Localize Microsoft Report Viewer


Scenario:
We have multi-language site. This site contains a lot of reports presented in different languages. But we have problem. The report viewer, the control which shows report, is English. We need to localize this control. Can you do it?

Answer:
Yes, its so simple.
there is interface called 'IReportViewerMessages'. Via this interface you can change report viewer internal controls value as the following steps:

STEP -1:
Add a class named, for example, 'ReportViewerMessages' which implement 'IReportViewerMessages'.

STEP -2:
Create GlobalResource named 'ReportViewerResource'.


STEP- 3:
Add the following line to your web.config:
<add key="ReportViewerMessages" value="YourClass, YourAssembly" />

Build and run your project and the result will be like the following: