Monday, March 19, 2012

Measure Group ID

Hi,

What is the thinking behind not allowing us to change the default value of the ID property of a measure group? I really don't like the default - I'd like to choose my own. (If thjere is a way to change it in BIDS then plesae let me know!)

This wouldn't be a problem except that the XML/A process command references the ID and I would rather have something in there that is intuitive - somehing that represents what the measure group is for.

Can I enter this as a feature request (i.e. allow us to change the ID property) at Microsoft Connect?

Thanks

-Jamie

OK, this was initially a minor irritation but its now become a pretty big problem.

I have split my measure group into partitions - one partition per year. I want to dynamically build a XMLA command at runtime that processes the current year. This would be easy if the partitions ID were all consistent e.g. :

"MyCubePartition 2004"|||

> What is the thinking behind not allowing us to change the default value of the ID property of a measure group?

In AS2000, objects only had names and because of dependencies between objects, changing a name was not possible after an object was created. In AS2005, to allow renamings, the ID was introduced. An object has a Name (used for browsing, localizable; also used in MDX) and an ID (used to define dependencies between objects and also used by the management API, commands like Alter, Create, Delete). The ID is immutable for the same reason as in AS2000: to not break the dependencies between objects.

> I really don't like the default - I'd like to choose my own. (If thjere is a way to change it in BIDS then plesae let me know!)

The wizards (for creating a DataSource, DataSourceView, Dimension, Cube, Partition etc) allow to specify the object name (usually at the last page). That name is also used as ID, a desired value can be used there.

But if you need to change later the IDs, there is no place in editors or wizards to do this, instead there is a limited work-around (I say limited because it's harder to do for objects with dependencies, but easier for partitions for example):

- script the Create statement for the object (in SQL Management Studio) and change the ID in the script

- delete the object (this is where it's harder for objects with dependencies)

- run the script


Adrian Dumitrascu

|||

Adrian,

Thanks for the reply.

To be honest, messing about with deployed objects give me the shivers so its not something I want to do. Not least because I want to make sure that EVERY deployment we do has the same IDs - so I want to make sure that the IDs that I want are stored in my BIDS project.

I accept your point about the reason for IDs being immutable but it doesn't solve my problem. What WOULD solve my problem would be if we could reference objects by name in the 'Process' command. Why can't we do that? Is it worth me raising a change request for this?

Regards

Jamie

|||

For changing the IDs in the BI project:

- you can edit the xml project files (right click and use 'View Code', for the .partitions file you need to use 'Show All Items' for the project, or just edit it outside Visual Studio); but this operation is easy for objects with no dependencies (like partitions); for objects with dependencies, you need to also edit the XML for their dependents

OR

- after you change the IDs for the deployed objects (in SQL Management Studio with scripting), you can re-create the BI project (File -> New Project -> Import Analysis Services 9.0 Database; please make sure you specify the same name for the project as the database, otherwise check the Target Database on project properties)

Adrian Dumitrascu

|||

Adrian Dumitrascu wrote:

For changing the IDs in the BI project:

- you can edit the xml project files (right click and use 'View Code', for the .partitions file you need to use 'Show All Items' for the project, or just edit it outside Visual Studio); but this operation is easy for objects with no dependencies (like partitions); for objects with dependencies, you need to also edit the XML for their dependents

Yeah I looked into hacking the XML earlier today and again - it scared me. A find and replace won't work because the ID of the measure group isn't always in an element called <MeasureGroupID>

Adrian Dumitrascu wrote:

- after you change the IDs for the deployed objects (in SQL Management Studio with scripting), you can re-create the BI project (File -> New Project -> Import Analysis Services 9.0 Database; please make sure you specify the same name for the project as the database, otherwise check the Target Database on project properties)

Not a bad idea. Thanks Adrian!

You're still skirting around my other suggestion though :)

All these nasty hacks and workarounds wouldn't be necassary if we could reference the object by name in the 'Process' command. It seems crazy to me that we can't do this.

Do you have any thoughts on that?|||

About referencing objects by name in the management API: we indeed don't have a way to do this now. But going back to the scenario of generating Process statement dynamically, I would say we don't need to change object IDs, nor to reference them by Name in the Process statement:

- if you are creating the partitions programatically (with AMO for example), then you have the control over the IDs, so you can generate the Process statements

- if you are creating the partitions manually with the wizard, then the Name you are specifying is also used as ID

- if at some point you don't know the ID, but only the Name, you can use AMO (Analysis Management Objects)to lookup the Partition by Name (myMeasureGroup.Partitions.GetByName("...")); once you have the Partition, you can generate the Process statement using the Scripter class (this thread mentions the Scripter class http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=476241&SiteID=1)

Adrian Dumitrascu

|||

Hi Adrian,

I know that its possible to get the IDs using AMO but I'm in the business of making life simple for myself and shelling out to get the IDs seperately is not my idea of making things simple.

Let me explain:

I have a collection of partitions named MyPartition2004, MyPartition2005, MyPartition2006...etc...|||

I've posted about this comment here: http://blogs.conchango.com/jamiethomson/archive/2006/06/20/4106.aspx

and there's an interesting reply from a guy about dynamically creating partitions as well.

-jamie

No comments:

Post a Comment