Thursday, August 7, 2014

How to get the current location using location manager android

Hi, I developed the Jogging Pal android app and used the following logic to get the current location using network and gps. I created a separate class as a service extended from Service abstract class and implemented it from LocationListner interface. It is better to check the provider status before you get the location unless it will give an exception. Configure the min distance change for update and min time change for update as you wish. Pass theses parameters to location manager's requestLocationUpdates method. For retrieving the current location you can use the getLastKnownLocation method in location manager passing the particular provider. This will give you the current location. When you are using this for indoor activities the results will not be too accurate. And finally make sure that you have added the permission on the Manifest, Jogging Pal / Android

Tuesday, June 11, 2013

How to Pass Multiple Parameters to Controller in MVC

There are several ways that we can implement this. I came across this because I had to pass 5 parameters to controller in my scenario. I got the solution using Ajax call inside the Jquery function. The Jquery function is as below. Here I got all the values from UI controls using Jquery selectors and insert all of them in to javascripts array like this the left side fields are same as the action parameters. Inside the ajax call the parameter values which are ready to be passed should convert into Json format. To convert into real object types, you should use the contentType: 'application/json; charset=utf-8', iside the ajax call. Finally I created the controller action method and it worked fine in the development environment. By using this method you can pass number of parameters to the controller action from the view. If you have any suggestions please leave a comment. Thank you.

How to Add an Image on a Hyperlink in a Kendo UI Grid Column

This is really interesting topic on developing Asp.net MVC applications. It is very easy to use Kendo UI grid with MVC and provides more functionality other than a normal grid. To reach the goal first we need to have a hyperlink column in our grid. This can be done using the ClientTemplate in the column. You can see it below. Inside the href tag you can add an image tag and give the particular image there. In hyperlink click event you can also pass data to controller. Inside the action link you can set the controller name and the action name there. Here the Id property pass as the action parameter. It is the value which is bound to the particular column. If you have any suggestions please leave a comment. Thank you.

Tuesday, January 17, 2012

How to Deploy a report in SSRS(SQL Server Reporting Services)

In my last post i discussed how to group a report in SSRS. Today I am going to explain how deploy the reports in SSRS. We can do it using SQL Server Management Studio environment and also using the Report Manager. First let's do it using SQL Server Management Studio development environment.

Open your report server project in SQL Server Management Studio. I assume that you can create a report under a report server project and if you are not aware of it refer to my previous posts. In your project right click on solution and click on the properties.



Then you can see a popup window comes out.



You have to change TargetReportFolder and TargetServerURL as in the window. If you wish to deploy reports to another server you can give its name. Sometimes it would ask for more permission. You can give any name for TargetReportFolder. Then click ok.

Now you can deploy reports by right clicking on solution and clicking Deploy.



Open the browser and type this URL (http://localhost/reports) 
This is the  URL  of Report Manager. You can see their your MyReports folder. It was successfully deployed.



Click on that folder and you can see their your report.



This is a simple way of deploying a report in SSRS. We can do this job using only Report Manager.
I will discuss it in my next post. Thank you.


Thursday, December 22, 2011

How to group a report in SSRS(SQL Server Reporting Services)

In my second post I showed how to add a filter to a report in SSRS. Today I am going to show how to create grouping to a report in SSRS.

For this task I am going to use a new report in SQL Server business intelligence development studio. I suppose you know how to add a datasource and the dataset to a report, if you are not aware of that you can refer my first and second posts in the blog. I created a stored procedure for my report dataset.



After setting the dataset, now you can design your report. Here first I added two columns to the table and named them as Name and Address.



According to the report dataset, teams are under groups and groups are under activities. So each activity can have more groups and each group can have more teams. Team can have members. Now what I need is to group the report under activity, group and team levels.

Below the report design view you can see there are two columns "Row Groups" and "Column Groups". Right click on row groups (Details) bar go to Add Group --- Parent Group. Now you can see a dropdownlist and select the report data field you need to group. I select the [Activityname]. Then click ok.







Then you can see your report like this and name the column header "Group1" as you need. I named it as Activity.



Now I need to group the report in group level and it is under the activity level. So you need to add a child group to first group. Right click on Group1 in the "Row Columns" go to Add Group --- Child Group. Then select the report data field you need to group. I select the [GroupName]. Click ok.







Now you can see report like this and rename the "Group2" column header as you need. I rename it as Group. Now I need to group the report in team level. Teams are under groups so again I create a child group under groups. Right click on "Group2" bar in Row Columns and go to Add Group as same as before and set a child group. Select the report data filed as you need. I select the [TeamName]. Click ok.








Rename the column header "Group3" as you need. I rename it as Team. Now my grouping part is over. You can now preview the report. Just click on Preview tab. You will see a report like this.



This is a one of grouping a report. In addition to this if your report contains number columns like "Initial Amount", "Paid Amount" you can set a total row and also a subtotal row in each group levels. For that task what you need to do is right click on the group bars under Row Columns and click on Add Total.

I think You got some knowledge about grouping a report in SSRS. Next time I will discuss how to deploy a report in SSRS. If you find anything useful please leave a comment. Thank you.

Thursday, December 8, 2011

How to Add a Filter to a Report in SSRS (SQL Server Reporting Services)

In my first post I showed how to create a report, add a datasource and add a dataset to it. Today I'm going to add a filter to that report and it is very important to add a filter because it make easier the user to search data.

First you need to add a parameter to the report data. In my report you can see there is a dataset field called Gender. I'm going to filter my report gender wise

(01). Go to report data and right click on parameter folder add a parameter.




you can see there are two fields Name and Prompt. Name is the name of the parameter and Prompt is the display name of the parameter. 


Then name the parameter as you wish. I named it as gender for parameter name and Gender for for parameter prompt





Then you have to set the parameter type. You can set it using Data type combobox. Here my dataset field Gender is a varchar value so I set the type as text.

Then keep the parameter visibility as visible.

(02). Click on the Available Values in report parameter properties. Now you can see three options listed and select the specify values.



Now you have to add and specify values that your report parameter can have.  Gender field can have Male or female. Click on the add button and set the label as Male and value as Male. Click again the add button and set the label value as Female and value as Female. Then click ok.






Now successfully created the report parameter that is used for filter.


(03). Go to report data again and right click on the dataset and go to dataset properties.






In dataset properties view click on filters. Then click on the add button. There you can see Expression, Operator and value lables. In Expression you need to select the field that you are going to filter. So it should be [Gender]. Then set the operator to be (=). Finally the value, this the most important part. In value field you have to give parameter value you pass to the report. value field set with the @ symbol. It should be as [@gender]. Then click ok. 







Now you added the filter to the report successfully. 

(04). Click on the preview tab of the report. Select a the filter value you need to filter the report. Then click on View Report.








Now you know how to add a filter to a report in SSRS. You can improve your report using filters. You can create filters using different parameter types as datetime, booleon, integer instead of text. I will discuss how to group a report in SSRS in my next post. Thank you.

Monday, December 5, 2011

Create a report in SSRS (SQL Server Reporting Services 2008)

SSRS is a comprehensive server based solution for reporting and it is widely used for creating, managing and delivering web based reports. Let's see a simple way of creating a useful report for a particular application.

(01). First open the SQL Server Business Intelligence Management Studio (Start menu > SQL Server 2008 > SQL Server Business Intelligence Development Studio)

(02). Then add a report server project under Business Intelligence projects.






(03). After adding the project right click on the reports folder in the solution explorer and click add new item. There you can select Report wizard and Report; we start with the report (.rdl).





(04). Now you have to design the report, you can use the toolbox items to add a table and  columns. You can also add a matrix instead of a table.



(05). When the table is added to the report it shows a popup to set the data source for the report.You have to set  a  particular  database  in  your  local  machine  or  a  particular  server  as  the  datasource. 









Make sure that when you set the connection to datasource keep the CheckBox (save my password) checked, otherwise you have to give datasource credentials when the report is previewed.  Now you have successfully created the datasource for your report. Then you have to set a dataset for the report. The dataset  can be created using Query Designer or a stored procedure in the datasource (database). We do it using stored procedure.


(06). Use a stored procedure to set it as the dataset of the project.




Now you can view the report data in a window by clicking the view in menu bar and clicking the report data on it. In report data there are folders named Built-in fields, Parameters, Images and Datasource. Inside the datasource folder you can see your dataset and its fields.





Then you can easily set the dataset fields to report columns as in the following image.






Now your report is ok. If the dataset stored procedure contains parameters they automatically added to the parameters folder in the report data. When you preview the report you need to provide the report parameters. Otherwise the dataset stored procedure doesn't contain parameters just click on the preview tab and report will be generated.




Adding filters, grouping and adding subtotals can be added this report and also add colors to make the report attractive. I'll discuss them in my next post.