23

I work with MDS 2008 / API to insert/update Models, Entities, Attributes and Members programmatically.

I want to get or set the description of one Model or one Entity.

If fact on Master Data Manager, we can see this on metadata of one model or entity: enter image description here

Here we can see the Description of the Model but we can't get or set it.

Does anyone know how to do that using MDS API?

Cœur
  • 37,241
  • 25
  • 195
  • 267
flow
  • 4,828
  • 6
  • 26
  • 41
  • I havent worked with MDS. However, take a look at [this link](http://technet.microsoft.com/en-us/library/hh245404.aspx). Does this help? – shahkalpesh Feb 20 '14 at 08:07
  • Why do you want to do it programmatically? Why not just change it using the management tool? – Paul Zahra Feb 26 '14 at 13:44
  • yes I cant to do it programmatically. But, even in MDM it seems to be impossible to change it. – flow Feb 26 '14 at 16:16
  • I believe this field is an extended property. http://msdn.microsoft.com/en-us/library/ms186885.aspx That's for MSSQL servers as a whole, it might work for MDS/MDM. The property itself is `MS_Description`. –  Apr 16 '14 at 21:56

1 Answers1

1

The description for a model is simply an attribute in the entity "Model Metadata Definition", that lives in the "Metadata" model. So changing the value should be just like changing the attribute value of any other entity.

Since I've never used the MDS API, I will describe how to do it using the MDS Stage Member tables and stored procedures, but I think this should give you an idea of how to do it using the API as well.

Since we're changing the "Description" attribute of member 22 (which is your Test-model), insert a record in the tblStgMemberAttribute-table:

insert mdm.tblStgMemberAttribute (ModelName, EntityName, MemberType_ID, 
    MemberCode, AttributeName, AttributeValue)
values ('Metadata', 'Model Metadata Definition', 1, 
    22, 'Description', 'My new description')

Then, you can either execute the batch using the manager, or execute it programmatically:

DECLARE @Version_ID int, @User_Id int

/* Get latest version of the model */
SET @Version_ID = (SELECT MAX(ID) FROM MDS.mdm.viw_SYSTEM_SCHEMA_VERSION  
                   WHERE Model_Name = 'Metadata')

/* Get the UserID from the username */  
SET @User_Id = (SELECT ID FROM mdm.tblUser u 
                WHERE u.UserName = 'domain\username') /* TODO: Replace domain/username */

EXEC mdm.udpStagingSweep @User_Id, @Version_ID, 1
Dan
  • 10,480
  • 23
  • 49