Reordering attributes with AMO or XMLA -
10-12-2006
, 05:31 PM
I'd like to programmatically reorder the Attributes in my dimensions. I can
accomplish this manually by choosing View Code in the BI Studio as I believe
it sends the "raw" Dimension XML definition to the server.
Using AMO I tried the following:
//...connect to the server and database...
Dimension d = db.Dimensions.FindByName("Time");
d.Attributes.Move(0, 1);
d.Update(UpdateOptions.ExpandFull);
I can see the Attributes being reordered (through d.Attributes[0].Name dumps
to the console window) so the operation is legal locally. But I get the
exceptions:
Errors in the metadata manager. The cube with the ID of 'Capital View', Name
of 'Capital Cube' was invalidated by operations in the transaction.
Errors in the metadata manager. The measure group with the ID of 'Capital',
Name of 'Capital' was invalidated by operations in the transaction.
Errors in the metadata manager. The transaction cannot be committed because
one or more objects were invalidated during the transaction.
If I try to use Script Dimension as... ALTER To.. in the SQL Management
Studio and copy/paste the the <Attribute> element into the new location, I
get the same error.
Is there something special I need to do or call to get this to work? Some
kind of "don't worry I'll reprocess next" property or method? I'm pretty new
to AMO to any tips would be helpful.
-zoltan |