This session was about Master Data Services and what it also could be used as - the client wanted an application to validate and submit warehouse inventories.
3. MDS – Used for more than just
Master Data Management
4. About me
Kenneth M. Nielsen
Managing Consultant at Rehfeld
kmn@rehfeld.dk
@doktorkermit
Linkedin.com/in/KennethMNielsen
www.funkylab.com
26-11-2014
5. Program
MDS – brief history
Scenario
Solutions
MDS as an application
Demo
MDS API
MDS Datamodel
Code Examples
?
26-11-2014
6. MDS – Brief history
Microsoft acquired Stratature MDM product
titled +EDM in 2007
Shipped with SQL Server 2008 R2
Almost useless, in that state
Major improvements in SQL Server 2012
release
No improvements in MDS for SQL Server
2014
26-11-2014
8. Scenario
Have to be able to calculate stockvalue after
provision and excess
Have to be able to generate import file to
Navision after calculation
Have to be easy to use, for controllers
MUST use data from Datawarehouse
26-11-2014
9. Solutions
Develop an application solely for this purpose
Look for standard software from Microsoft,
that we already paid for
Small changes / custom development is allowed
Keep the manual process
26-11-2014
10. We chose
We chose Master Data Services from
Microsoft
Comes out of the box with SQL Server
2008r2/12/14 (Enterprise and BI)
Fairly easy to use
Add-in for Excel
Fairly easy to implement business rules
Custom workflows and Custom Business rules
can be implemented
SQL Server already bought and paid for
26-11-2014
12. Solution implemented
Data read daily from datawarehouse
Until freezedate is hit, the load stops
At freezedate, data is moved to separate
MDS entities (lists)
When freezeperiod is over data, is loaded
again.
26-11-2014
13. Solution implemented
26-11-2014
1. Check if Version exists in MDS
1. Yes - Then delete (to empty)
2. No – Then copy from template
2. Truncate MDS staging
3. Move data into MDS staging
4. Load data MDS staging to Model
5. Validate Model
14. MDS API
Most operations can be started by T-sql or by
stored procedures in SSIS
Open API, not like in Data Quality Service,
where everything is encrypted
Not that much documentation at hand
A few blogposts so far, community is building
Use Profiler to listen and catch T-SQL and
Stored procedure calls from MDS manager
26-11-2014
15. Profiler Demo
Set up profiler
Navigate MDS manager
26-11-2014
16. MDS Automation
Housekeeping packages
Create subscriptionviews
Lock Version
Unlock Version
Copy Version
Import Data to Model
Truncate Model
Disable Business Rules
Enable Business Rules
26-11-2014
17. MDS Automation
Create Subscriptionviews via MDS
Slow process
Manuel process
26-11-2014
18. MDS Automation
Create Subscriptionviews via SSIS or stored
procedures
Fast
Automation
Meta data driven
26-11-2014
21. MDS List
The controller can only see and
edit his own data
And only the columns that need
information from him
26-11-2014
22. Custom Workflow i MDS
Almost no documentation – one article on
technet http://tinyurl.com/nhaknla
Must be installed by hand
No good debugging
Blogpost on the way describing this in details
on www.funkylab.com
26-11-2014
23. Workflow DLL – C#
Remember to add references to the MDS workflow
Microsoft.MasterDataServices.Workflow;
Microsoft.MasterDataServices.WorkflowTypeExtender;
XmlNode xmlBusinessRule =
dataElement.SelectSingleNode("//ExternalAction/Server_URL");
string BusinessRule = xmlBusinessRule.InnerText;
26-11-2014
24. Workflow DLL – C#
using Microsoft.MasterDataServices.Workflow;
using Microsoft.MasterDataServices.WorkflowTypeExtender;
namespace EaOBusinessRule
{
public class GNCustomWorkFlow : IWorkflowTypeExtender
{
public void StartWorkflow(string workflowType, System.Xml.XmlElement dataElement)
{
XmlNode xmlBusinessRule = dataElement.SelectSingleNode("//ExternalAction/Server_URL");
string BusinessRule = xmlBusinessRule.InnerText;
switch (BusinessRule)
{
case "CalculateTotals":
26-11-2014
ExecuteBusinessRule_CalculateAfterAdj(workflowType, dataElement);
break;
//case "do something else
//ExecuteBusinessRule_CalculateSomethingElse(workflowType, dataElement);
default:
break;
}
}
25. Workflow DLL – C#
Attribute names in XML
Blanks will be replaced by _x0020_
dataElement.GetElementsByTagName
("Adjustment_x0020_Obsolete")[0].InnerText;
26-11-2014
26. Workflow DLL – C#
Look up attributeID’s in MDS datamodel
EntityID is read from MDS XML
dataElement.GetElementsByTagName("Entity_ID")[0].InnerText;
SELECT CAST([ID] AS VARCHAR(100)) AS [ID]
FROM [mdm].[tblAttribute] AS attributes
WHERE attributes.[Entity_ID] = " + EntityID.ToString() + "
AND attributes.[Name] = 'Total Provision'
26-11-2014
27. Custom Workflow i MDS
Configured by XML
<applicationSettings>
<Microsoft.MasterDataServices.Workflow.Properties.Settings>
<setting name="ConnectionString" serializeAs="String">
<value>Server=10.200.10.160;Database=MDS;Integrated Security=SSPI</value>
</setting>
<setting name="WorkflowTypeExtenders" serializeAs="String">
<value>MDSWFS=EaOBusinessRule.GNCustomWorkFlow, EaOBusinessRule, ….</value>
</setting>
</Microsoft.MasterDataServices.Workflow.Properties.Settings>
</applicationSettings>
26-11-2014
28. Debugging Custom Workflow
Easiest way to debug is writeing to the
console
Start workflow service in ”console mode” on
the server where MDS is running
Microsoft.MasterDataServices.Workflow.exe
–console
26-11-2014
En gennemgang af den løsning der fandtes, der sidder x antal kontrollere rundt om I verden der udarbejder lager beholdningslister
Listerne sendes månedligt til en global controller.
Lagerlister er baseret på de locale controllers egne regneark, baseret på de egne lager tal
Giver ikke global controlleren mulighed for at have styrpå det globale lager
Hver local controller får hver deres MDS liste som de kan lave lager justeringer I
Nedskrive, hensætte
Global controlleren kan derefter godkende de enkelte rækker.
Vis hvor lang tid det tager at lave views I hånden.
Lav evt et view på exchange rate
Her oprettes 23 views på sekunder.
Hus at rette XML koden til – connectionstrings , namespace på DLL
Remote debugger er en mulighed, men det kræver en del opsætning, og udviklingsværktøjer på serveren