views:

99

answers:

1

I'm modifying my Report Model in Visual Studio (2008). If I refresh my dsv file (after changes to the underlying database), then manually reflect the same changes in the smdl file, it seems that any time I delete an Attribute from an Entity it somehow corrupts the ReportModel project.

Deleting an attribute removes a reference like the following from the <IdentifyingAttributes> and <DefaultDetailAttributes> sections of the smdl file:

<AttributeReference>
  <!--My Attribute-->
  <AttributeID>G30ea3652-7f92-41d0-a25a-500c82317288</AttributeID>
</AttributeReference>

And also removes the attribute itself:

<Attribute ID="G30ea3652-7f92-41d0-a25a-500c82317288">
  <Name>My Attribute Name</Name>
  <DataType>Integer</DataType>
  <Nullable>true</Nullable>
  <SortDirection>Descending</SortDirection>
  <Width>4</Width>
  <Format>g</Format>
  <EnableDrillthrough>true</EnableDrillthrough>
  <ContextualName>Merge</ContextualName>
  <ValueSelection>Dropdown</ValueSelection>
  <Column Name="Blah" />
</Attribute>

I can't see how this would mess up the smdl file.

Anyway, my question is: has anyone else had the same problem? If so, is there a way round it (aside from Autogenerating the smdl).

Also, is there a reason for not Autogenerating? (I've been told not to by a colleague, but don't understand the motivation behind this)..

Thanks in advance for your help, Pete.

A: 

OK, I can answer my own question here. It seems there's an issue relating to Hidden Fields. If the Attribute or Role you are trying to delete is referenced from the Hidden Fields collection of another Role, then when you delete it (the Attribute or Role), then the reference held in the collection is orphaned. It looks as though Visual Studio isn't clever enough to do this - bah!

When you then try to re-open the Report Model project after saving it, you get the lovely, expressive error message: "Object reference not set to an instance of an object."

The only way I can see to resolve this when I get the "Object Reference..." error is to open the smdl file in Notepad (or similar) and to search for the GUID reference of the thing you're deleting. Note in the case of a Role it could happen on either end - the Source or Target - of the relationship.

Pete Morgan