Showing posts with label amo. Show all posts
Showing posts with label amo. Show all posts

Friday, March 9, 2012

NullReferenceException from AMO - Connect

Server svr = new Server();

svr.Connect(Properties.Settings.Default.OLAPConnectionString);

(Server is of type Microsoft.AnalysisServices.Server)

Results in:

NullReferenceException: Object reference not set to an instance of an object.

at Microsoft.AnalysisServices.DesignXmlReader.CheckForXmlaException()

at Microsoft.AnalysisServices.DesignXmlReader.ReadRoot(Type type)

at Microsoft.AnalysisServices.DesignXmlReader.DeserializeComponent(IDesignerSerializationManager manager, XmlReader reader, Type root)

at Microsoft.AnalysisServices.JaXmlSerializer.DeserializeComponent(IDesignerSerializationManager manager, XmlReader reader, Type root)

at Microsoft.AnalysisServices.AnalysisServicesClient.Discover(IMajorObject obj, ObjectExpansion expansion)

at Microsoft.AnalysisServices.Server.Refresh(IMajorObject obj, ObjectExpansion expansion)

at Microsoft.AnalysisServices.Server.SendRefresh(IMajorObject obj, ObjectExpansion expansion)

at Microsoft.AnalysisServices.MajorObject.Refresh()

at Microsoft.AnalysisServices.Server.Connect(String connectionString, String sessionId)

at Microsoft.AnalysisServices.Server.Connect(String connectionString)

at ... my code, the call to Connect, above

The connection string is non-null, and names a valid, running SSAS database on the local machine. Any theories? This code has been working fine up till now, and nothing's changed in the cube or the enclosing database in weeks. The only thing of interest that changed recently was a batch of updates from Windows Update - but that seems very unlikely since none of them were SSAS related.

... and, wouldn't you know it, next time through, the code worked fine. The process hasn't even been re-started. I hate bugs that "fix" themselves!

This is typically a result of late bindings. Not necessarily a bug, just a runtime risk.

Adamus

|||Actually, I think the problem was simply that I had VS set to stop on exception throw, instead of stop on unhandled. Second time through, I'd changed the settings. Presumably this exception was thrown, caught and handled inside of AMO and is nothing to worry about.

Monday, February 20, 2012

Null Measure Data Processing....

Hello,

I created a cube with measures and dimensions using AMO. The measure group comes from a table called "client_coverage", and there is a measure called "count". There are also 2 dimensions, namely "TimeZone" and "Source".

For example,

Coverage

ID TimeZone Source

-- -- --

1 null null

2 null null

I've programmably set the "null processing" for measure "count" to "preserve", and both dimensions' UnknownMembers to "visible" and set their key column's "Null Processing" to "Unknown Members".

However, when I browse the cube, there is no number shows up for the coverage "count" measure. I've checked that the dimensions are setup correctly with proper relationships to the coverage measure group.

Interesting thing is, if I remove the cube dimension manually from the cube using the Business Intelligence studio and then right away add them back in. Then the number shows up.... like :

Source Count

- --

Unknown 2

I wonder if there is something needs to be done in my AMO program when adding the cube dimensions (the things that the BI studio does automatically).

Any help is very appreciated..

Thank you very much,

Sincerely,

Hsiao-I

Ah.. I found out that I have to set the relationship between the measure group and the dimension's "Null Processing" property to the same as the Dimension's Null Processing property... that solved the problem!!