If your business operates like any would and has the need to report on data from custom functionality then you might find this post useful. In creating custom functionality we often have the need to create new custom Enums and store the values in a custom table. Doing so works just fine inside the Dynamics circle. However, if you use a separate reporting engine outside of Dynamics, like SSRS, to render your reports, you will find that your users will not understand what a ShipStatus of 2 is, and let's be serious, your proposed solution to hard code your enum labels in your report is a poor strategy.
Microsoft was nice enough to create some tables to store enum values and labels for some of these enums. These are located in two tables, namely, SRSAnalysisEnums and SRSModelEntityCache. But, like I mentioned earlier, there are only SOME enums in these tables. For a long time it was mysterious to me why it was this way, but after some digging in and a few "Ah ha!" moments later I figured it out. It also introduced me to another unknown area of Dynamics.
Today, we're going to learn about Perspectives. It's an object in the AOT under Data Dictionary. Perspecitves in Dynamics are a poor attempt to mimic the functionality of a database cube. It's not as flexible as a real cube and not very customizable. If you expand the Perspectives node, you'll see a Perspective object for each Module. Each of these perspectives has a list of tables. Any enums in these tables listed under a perspective are the enums that show up in the SRS tables. To get your new enums to show up you just need to have your table included in one of these perspectives or create your own, but try to put your table in the most relevant module, pertaining to the data that's stored in the table.
Note: If your table is already in these perspectives, read ahead.
Now, putting the table in the perspective alone won't put your enums in the table. You also have to update the model so the SRS tables get populated correctly. The way to do this is Tools->Reporting tools->Update models. You can choose to update all languages or just one, as you feel is necessary for your business. Running this will take awhile, but when it is finished, you will now see your new enums show up in the SRS tables. Here's a script that will get your enum labels from a value:
FROM SRSModelEntityCache ec
JOIN SRSAnalysisEnums ae
ON ae.EnumId = ec.EntityId
WHERE ec.PhysicalName = 'BaseEnum_ShipStatus'
AND ae.EnumItemValue = 2
How can i separate the two enum in the report?ReplyDelete
I'm not sure what you mean, but if you are getting multiple results, you should verify that you are picking the record from the correct language setDelete
Thank you for sharing lot of information. Very informative post. Covered almost everything. Please Keep sharing such a useful content for us. please continue this work, also refer some informative blogs on Product Engineering Services for more contents about the product service based knowledgeReplyDelete