Friday, August 22, 2014

When you save a list as a template do the workflows save with that template?

Issue:

When you save a list with workflow ( save web a site template), workflow get saved with list but it does not work.

 

Resolution:

When you create a workflow with Sharepoint designer it is associated to a specific list on a specific web.
When that web is saved site as template it includes the workflow but the workflow when you create site from
"Your" template are associated to the old list. You need to open the new site in Sharepoint Designer. Then open the workflow
in an editing session, click the xmol(from folder view (click all files in SPD)) file in the workflow folders then the "back" button then repick the list in the associations dropdown.
Save or finish or whatever., some other workflow references in each step may have to be reset as well (that part depends) particularily with cross list interaction.

If you find yourself doing this too often you need to develop in Visual Studio or try and figure out the XML declarative workflow files GUID or use an old third party codeplex project application that claims to auto associate those Sharepoint Designer designed workflows.

 

 

Abstract Class versus Interface

In this article along with the demo project Interfaces versus Abstract classes are discussed. The concept of Abstract classes and Interfaces is a bit confusing for beginners of Object Oriented programming. Therefore, tried to discuss the theoretical aspects of both the concepts and compare their usage. And demo project is attached with code.

Background

An Abstract class without any implementation just looks like an Interface; however there are lot of differences than similarities between an Abstract class and an Interface. Let's explain both concepts and compare their similarities and differences.

What is an Abstract Class?

An abstract class is a special kind of class that cannot be instantiated. So the question is why we need a class that cannot be instantiated? An abstract class is only to be sub-classed (inherited from). In other words, it only allows other classes to inherit from it but cannot be instantiated. The advantage is that it enforces certain hierarchies for all the subclasses. In simple words, it is a kind of contract that forces all the subclasses to carry on the same hierarchies or standards.

What is an Interface?

An interface is not a class. It is an entity that is defined by the word Interface. An interface has no implementation; it only has the signature or in other words, just the definition of the methods without the body. As one of the similarities to Abstract class, it is a contract that is used to define hierarchies for all subclasses or it defines specific set of methods and their arguments. The main difference between them is that a class can implement more than one interface but can only inherit from one abstract class. Since C# doesn’t support multiple inheritance, interfaces are used to implement multiple inheritance.

Both Together

When we create an interface, we are basically creating a set of methods without any implementation that must be overridden by the implemented classes. The advantage is that it provides a way for a class to be a part of two classes: one from inheritance hierarchy and one from the interface.

When we create an abstract class, we are creating a base class that might have one or more completed methods but at least one or more methods are left uncompleted and declared abstract. If all the methods of an abstract class are uncompleted then it is same as an interface. The purpose of an abstract class is to provide a base class definition for how a set of derived classes will work and then allow the programmers to fill the implementation in the derived classes.

There are some similarities and differences between an interface and an abstract class that I have arranged in a table for easier comparison:

Feature

Interface

Abstract class

Multiple inheritance

A class may inherit several interfaces.

A class may inherit only one abstract class.

Default implementation

An interface cannot provide any code, just the signature.

An abstract class can provide complete, default code and/or just the details that have to be overridden.

Access Modfiers

An interface cannot have access modifiers for the subs, functions, properties etc everything is assumed as public

An abstract class can contain access modifiers for the subs, functions, properties

Core VS Peripheral

Interfaces are used to define the peripheral abilities of a class. In other words both Human and Vehicle can inherit from a IMovable interface.

An abstract class defines the core identity of a class and there it is used for objects of the same type.

Homogeneity

If various implementations only share method signatures then it is better to use Interfaces.

If various implementations are of the same kind and use common behaviour or status then abstract class is better to use.

Speed

Requires more time to find the actual method in the corresponding classes.

Fast

Adding functionality (Versioning)

If we add a new method to an Interface then we have to track down all the implementations of the interface and define implementation for the new method.

If we add a new method to an abstract class then we have the option of providing default implementation and therefore all the existing code might work properly.

Fields and Constants

No fields can be defined in interfaces

An abstract class can have fields and constrants defined

 

Demo: http://www.codeproject.com/KB/cs/abstractsvsinterfaces/AbstractsVSInterfaces_src.zip

Monday, August 4, 2014

Microsoft .NET framework

The Microsoft .NET framework is a software framework for developing applications for Microsoft Windows although it was engineered in such a way so that other parties can develop the same framework for other operating systems.

The Common Language Runtime (CLR) is the executing engine of the .NET framework, it’s basically its core and the implementation of the Common Language Infrastructure (CLI). CLI is an open specification developed by Microsoft that defines how these core engines should be built, engines that among other things define common types, memory management and security. That way if an application is developed for one CLI (in the case of Microsoft, CLR) it can be run on any other OS running a version of the CLI.

Besides the core engine, the .NET framework includes many other class libraries that help developers create Windows applications and web applications. In order to develop applications the developer must choose a language. Two of the most popular .NET languages are VB.NET and C#. Both are object oriented (OO) although there are some aspects of OO not available to each language. Deciding which language to develop with depends on many variables, not least of which is your knowledge and comfort level with the language.

When you compile and build a .NET solution, whether it’s developed with VB.NET or C#, it’s converted to something called the Common Intermediate Language (CIL) also defined in the CLI.

The CIL is a lower level readable language that the CLR can execute but isn’t platform or processor specific. When executed by the CLR it converts the CLI code to the native code (machine code) for that processor. This means that you can develop one set of code and distribute across different systems that implement a version of the CLI.

 

Sunday, April 20, 2014

Create a dashboard in Sharepoint 2010 with SharePoint List as a Datasource

In Continuation with my previous posts on how to create a dashboard and a KPI and about various data sources for dashboard, in this post I will add the steps to create a Dashboard with SharePoint List as a Datasource

Important things to remember -

1. The data from the SharePoint lists can only be read by using PerformancePoint Services; any editing of the data must be done from SharePoint Server.
2. You can connect to any kind of SharePoint list.

Steps to create a SharePoint list datasource are :

1. Right-Click the Data Connections folder in the Workspace Browser, and then select New Data Source.

2. In the Category pane of the Select a Data Source Template dialog box, click Tabular List and then click SharePoint list. Click OK.

3. In the left navigation pane (workspace browser), type a name for your data source.

4. In the center pane, click the Editor tab. In the Data Source Settings section, select the method on which to authenticate to the data source.

5. In the Cache Lifetime drop-down list, type the refresh rate (in minutes) for the cache. Data from this data source will update at this interval.

6. In the Connection Settings section, type the URL to the SharePoint site.

7. In the SharePoint Site List drop-down, select a List collection.

8. In the List drop-down list, select the desired SharePoint list from the collection.

9. Click Test Data Source to confirm that the connection is configured correctly.

 

Create a dashboard in Sharepoint 2010

In continuation with my earlier Post about performance point and the prerequisites for creating a dashboard. In this post we will look at the steps to create a new dashboard and a scorecard.

First lets look a quick summary about KPI,Scorecard and Dashboards.

Summary -

KPI's are indicators to measure certain goals in the company. You can create KPI's from different back-end sources using Performance point.

ScoreCard - This is collection of KPIs. You drag-drop your KPI's to a scorecard.

Reports - Lastly, you create reports to be added to your dashboard.

All the above components will create a dashboard for you. Now lets look at them in Detail.

To Create a Dashboard Open the Dashboard Designer. To do this follow the Steps below
1. In Internet Explorer, navigate to the Business Intelligence Center site that you must have created.
2. Click the Create Dashboards link, and then click Start using PerformancePoint Service link.
3. From the PerformancePoint Services page, click the big button that says Run Dashboard Designer. This will download and install the PerformancePoint Dashboard Designer to your workstation.
Once the executable fi le is downloaded and installed on your computer, the PerformancePoint Dashboard Designer appears. Once the Dashboard Designer is installed, you have an empty workspace. A workspace is a primary container for all of the elements that you can use to build your dashboard, and it keeps its content synched with the site from which it was launched.

Creating Your Dashboard -

Before we get started with building a dashboad lets just create a Dashboard Datasource first.

To create a Dashboard Datasource follow the below steps :

1. Right – click the Data Connections folder in the Workspace Browser, and then select New Data Source.
2. From the Select a Data Source Template menu, choose the Analysis Services template to create a datasource that connects to Microsoft SQL Server Analysis Services, and click OK. Next Configure the Connection Settings.
3. Watch for Cache Lifetime setting. The value of this textbox (in minutes) indicates the interval of refreshing the dashboard information from the backend datasource.
4. Click Test Data Source to make sure that your connection settings are correct.
5. Switch to the Properties tab and change the Name of your datasource.
6. Save the new datasource by right – clicking it in the Workspace Browser, and then selecting Save.

Creating KPI –

Now that we have our connection ready lets create our key performance indicator (KPI). In order to create a new KPI to track what ever you wanna track for your company, you need to follow these steps:

1. Right – click the PerformancePoint Content folder and select New KPI.
2. In the Select a KPI Template dialog, select Blank KPI, and then click OK.
3. And once you have your KPI created, you can define your actual and Target values. Also, select the data source and the measure.
4. Click OK to close the dialog.
5. Select the Target row, and click the Set Scoring Pattern and Indicator button in the Thresholds area.
6. Next, In the Edit Binding Settings dialog, select the fi rst option (Band by normalized value of Actual/Target) from the Banding method drop – down, and then click Next.
7. In the Select an Indicator step, select an indicator to use for the target that clearly shows whether the goal is met. You can choose from a collection of indicator templates available in PerformancePoint Dashboard Designer. Once you are done, click Next.
8. In the last step of the wizard, leave the value intact and click Finish.
9. Save the KPI by right – clicking it in the Workspace Browser, and then selecting Save.

 

Wednesday, April 16, 2014

oracle case and decode function syntax

Oracle doesn't provide such IIF Function. Instead, try using one of the following alternatives:

DECODE Funciton:

SELECT DECODE(EMP_ID, 1, 'True', 'False') from Employee

CASE Function:

SELECT CASE WHEN EMP_ID = 1 THEN 'True' ELSE 'False' END from Employee