Sunday, February 26, 2012

Generate Report Model from Cube with perspectives

1. Is there a way to generate SMDL programmatically from a cube besides using the RS Webservice API?

2. Is there a way to programmatically modify the SMDL once it has been created without doing crazy xml manipulation?

3. How can I create a Report Model from a cube with multiple perspectives? I want the model to only contain one perspective of the cube.

First, there's a real lack of responses on this forum....but hopefully this will help someone else that ran into these issues.

1. It's better to modify the SMDL that's generated from the API then to try and create it from scratch

2. The only way is with xml manipulation but it's actually not that bad. The schema is pretty simple. It just looks bloated at first with lots of repeating elements.

3. When the SMDL is generated, each perspective in the cube becomes a perspective in the report model. Then you can trim down the perspectives you don't want by removing the corresponding element from the SMDL and saving it back to reporting services.

Other things I notice is that once you modify the SMDL, you can't regenerate it using the Regenerate API call. Instead, you have to delete it and recreate it again. Also, once you recreate a model, you have to link up all the reports that were previously associated with it. I have no idea why RS removes the datasource from reports when the model is deleted. It's probably better to just leave it and if the datasource isn't there, then throw an error.

|||

Other things I notice is that once you modify the SMDL, you can't regenerate it using the Regenerate API call. Instead, you have to delete it and recreate it again. Also, once you recreate a model, you have to link up all the reports that were previously associated with it. I have no idea why RS removes the datasource from reports when the model is deleted. It's probably better to just leave it and if the datasource isn't there, then throw an error.

Actually, you will want to use the SetModelDefinition API instead of Renenerate. Items in the Report Server database are linked by GUID, not name. Just because it has the same name, we don't assume that it is the same item.

|||I do use SetModelDefinition API to modify the SMDL. But after a cube has been processed and the structure changed, I will need to regenerate the model base on the new cube. If I do that, all my reports break because the datasource reference is no longer valid even though the model has been recreated. This makes sense in the situations where the report may contain references to dimensions/measures no longer in the datasource. However, in my case, dimensions/measures are often added to the cube and not removed. I just think it's better to leave the datasource and have the report fail if dimensions/measures are missing instead of ALWAYS failing with an invalid datasource.

No comments:

Post a Comment