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:
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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With