0

I want to use SSAS cube to get data from Dynamics AX and Pass data to wpf Devexpress PivotGrid. I am using following order in AX to create cube: Perspective-->View-->Query(with arguments) Now when I change the arguments of query everytime I have to Process the cube manually and render the data. I want that process to be done through c# code automatically. i had tried below code

Server server = new Server();
server.Connect(cubeConnectionString);

Database database = server.Databases.FindByName(databaseName);
Cube cube = database.Cubes.FindByName(cubeName);

cube.Process(ProcessType.ProcessFull);

but it is not working. Can anyone help??

2
  • I suggest you also open a thread on the devexpress support forum Commented Jul 4, 2014 at 13:37
  • 2
    You write "but it is not working". It is difficult to guess an answer. What do you mean by this sentence? Does your code not compile? Do you get errors when executing it? What are the error messages? Do you not get any errors and warnings but there is no data? Or are there wrong or missing data in the cube? Commented Jul 7, 2014 at 19:00

2 Answers 2

2

I am not knowing what the error you are getting. To process cube from C# the code you have used seems correct but might you have missed something in connection string. For Reference you can download sample project provided in this link to my blog:

Process Cube dynamically in C#

Code which I had used to process my cube database is like below...

 Server server = new Server();

 server.Connect("Data source=YourSSASServerName;Timeout=7200000;Integrated Security=SSPI");

 Database database = server.Databases.FindByName("YourCubeDBName");

 database.Process(ProcessType.ProcessFull);
Sign up to request clarification or add additional context in comments.

1 Comment

I implemented the code mentioned an it works but in case there is error at the db level, in my case the data source was unavailable , the function doesn't throw any error or exception. Can you please suggest on this.
0

I know this question is a few years old, but I recently developed a solution to do this. I stumbled across this question when trying to solve the problem myself.

First, check your permissions, see if you can process it via SSMS, but I assume you've already done that.

The second is using the right libraries. The two libraries you should be using are:

  • Microsoft.AnalysisServices and
  • Microsoft.AnalysisServices.Core

For me, I used version 14.x of both, and each dll needs to have the same version number

The Server object you create is actually Microsoft.AnalysisServices.Server and that class needs Microsoft.AnalysisServices.Core.Server see https://learn.microsoft.com/en-us/dotnet/api/microsoft.analysisservices.server?view=analysisservices-dotnet

The doco at https://learn.microsoft.com/en-us/dotnet/api/microsoft.analysisservices?view=analysisservices-dotnet also highlights the need to use both libraries.

Microsoft.AnalysisServices.Core.Server is an abstract class, so you won't be able to instantiate it, that's why you use Microsoft.AnalysisServices.Server. See https://learn.microsoft.com/en-us/dotnet/api/microsoft.analysisservices.core.server?view=analysisservices-dotnet

Today, you'll need to use dotnet 4.x, I don't think .Net Core will allow you to use these libraries (I could be wrong). Using .Net Core failed for me, complained about 'WindowsImpersonationContext'

In the end, the following code worked for me...

using Microsoft.AnalysisServices;
using Microsoft.AnalysisServices.Core;

void Main()
{

Microsoft.AnalysisServices.Server server = new Microsoft.AnalysisServices.Server();

server.Connect("servername") ;

Microsoft.AnalysisServices.Database db = server.Databases.FindByName("SSAS_DBName");

Microsoft.AnalysisServices.Cube cube = db.Cubes.FindByName("CubeName");

cube.Process( ProcessType.ProcessFull ); 

}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.