Programming Performance Point Services 2010 – Part 2 (Create a new DataSource In Performance Point Programmatically)


Check the First Post (Click Here)

The Below function will allow you to create a new DataSource inside Performance Point

public IDataSource CreateNewAnalysisServicesDataSource(string dataSourceName,string serverName,string databaseName,string cubeDisplayName,DSConnectionContext connectionContext)
        {           
// Get a New Instance from the Service 
PPSWebService service = PPSWebService.GetInstance();         
  // Create a new Data Source Instance 
DataSource newDS = DataSource.CreateNew();            
newDS.Name.Text = dataSourceName;            
newDS.Description.Text = "Created By System";
newDS.ServerName = serverName;            // Set the Data Source Type to Analysis Services Type newDS.SourceName = "ADOMD.NET"; newDS.CubeName = cubeDisplayName; newDS.MinutesToCache = 10; newDS.ContentType = FCOContentType.PpsDataSource;
// Set the Connection Type Based on Enumerator 
if(connectionContext == DSConnectionContext.PerIdentity)            
{            
newDS.ConnectionContext = ConnectionContext.ConnectAsUser;            
}else if(connectionContext == DSConnectionContext.SharedUser)            
{                
newDS.ConnectionContext = ConnectionContext.ConnectAsSharedUser;            
}

newDS.DatabaseName = databaseName;

// Request the Service Instance to Create the DataSource 
PPSWebService.GetInstance().WebService.CreateDataSource(Configurations.PerformancePointDefaultDataConnectionsList, newDS);

return new Datasource(newDS);

        }

To be Able to restore the DataSource Again Always Store the List URL (Relative Path and the Item Index in your Data Store)

The Default List Should be store in a Relative Path like the below sample:

“Data%20Connections%20for%20PerformancePoint/”

Feel free to Contact me for more info mahmoud.m.moussa@live.com

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s