Saturday, February 25, 2012

Process Add by AMO

Hi,

I want to write a programm which adds entries to an sql table and then process the dimension with processadd to only add this single row.

I have checked the samples and internet forums - but could not find out howto do..

anyhow I miss the link between a querybinding and the process command of the dimension...

I thought it would be something like...

Code Snippet

/* connect to lap server */

olapClient.Connect("DataSource=" + OLAPServerName);

/* get the Database */

Database olapDB = olapClient.Databases.GetByName(DatabaseName);

/* get the Dimension */

Dimension olapDim = olapDB.Dimensions.GetByName(DimensionName);

/* process the dimension and add the items i have created before */

olapDim.Process(ProcessType.ProcessAdd, new QueryBinding(DataSourceName, "select * from dbo.Slot where Slot='" + ResultID + "'"));

but this only raises an error ("

Errors in the metadata manager. The object reference is not valid. It does not match the structure of the metadata class hierarchy.")

How is this done correctly?

I want to use AMO to not write the xmla command statically - if there are further changes - but the dimension is build up to 100% of the single table dbo.Slot.

An example or a link would be helpfull.

HANNES

Nobody an idea?|||

Check this out. I think this guy has worked out the issues:

http://www.artisconsulting.com/Blogs/tabid/94/EntryID/2/Default.aspx

|||

I have seen this. My Question is - how do I programmatically create the xmla command. It seems AMO always creates wrong commands - the command always looks like a Process ADD for a partition - even if we do it on the dimension object.

It you confirm that there is no other way I will go by manually write xmla. But the drawback is - if we change the dimension I have to manually change the XMLA - and parts of the code - and otherwise the would be much less maintenance.

Hannes

|||

When I review the blog, it appears he works out both techniques. In his first example, he shows how to use query bindings which works for the Partition version. Towards the bottom, he shows you that you must create a DSV in AMO to provide the data source for the Dimension verions. (The DSV is used instead of the query bindings.)

I've looked through the Melomed et al. (SAMS) and Lachev (PROLOGIKA) books and do not find any additional info that would be of help to you. In the Harinath and Quinn book (WROX), an XMLA example of the process add against a dimension is shown on page 443. It too shows a DSV being generated to hold the query for the process add on the dimension.

Good luck,
Bryan

No comments:

Post a Comment