none
Calling external assembly in SSAS gives "Internal Error" when input array gets too long

    Question

  • I have created an external .Net assembly to calculate IRR using the Microsoft.VisualBasic.Financial namespace, as SSAS 2008 apparently can't do this on its own. My assembly takes as input an array of double values, and outputs a single double value back to SSAS. As long as the array of values is 38 or below in length, SSAS displays the IRR just fine. 39 values and above, it gives me the error: Internal error: An unexpected exception occurred.
    I have debugged the assembly, and the array with all its values is in fact transferred to the assembly and the IRR is calculated correctly, but when the result is sent back to SSAS, the error occurs. Even if the result output is set to a dummy variable the error is the same when input is above 38 values.
    The error occurs on both 64-bit and 32-bit SSAS 2008.
    Does anyone have a clue why this is happening?

    Regards,
    Jon
    Tuesday, January 12, 2010 10:12 AM

Answers

  • Hi Jon,

    You can in fact pass a set (data type Microsoft.AnalysisServices.AdomdServer.Set), as well as a tuple or member. This set has a Tuples collection, and each tuple in that in turn has a member collection.

    For sample code how to work with these data types see the AS stored procedures project: http://asstoredprocedures.codeplex.com/.

    Frank
    • Marked as answer by Five-O Wednesday, January 13, 2010 5:00 PM
    Wednesday, January 13, 2010 2:03 PM

All replies

  • Hi Jon,

    No idea why this happens. But could you as a workaround use a set to pass the parameters?

    Frank
    Tuesday, January 12, 2010 8:58 PM
  • Hi Frank,
    Thanks for answering.
    How would I go about doing that?
    Arrest me if I'm wrong, but I don't think .Net (C#) accept a set as input. Now I use the SetToArray-function in the MDX query, so that the set is converted to an array and then passed to the .Net assembly.
    Also, the .Net assembly works fine if I call it from another .Net application with array length longer than 38 values..

    Regards,
    Jon
    Wednesday, January 13, 2010 11:55 AM
  • Hi Jon,

    You can in fact pass a set (data type Microsoft.AnalysisServices.AdomdServer.Set), as well as a tuple or member. This set has a Tuples collection, and each tuple in that in turn has a member collection.

    For sample code how to work with these data types see the AS stored procedures project: http://asstoredprocedures.codeplex.com/.

    Frank
    • Marked as answer by Five-O Wednesday, January 13, 2010 5:00 PM
    Wednesday, January 13, 2010 2:03 PM
  • Thanks, Frank! Now it works like a charm!
    I'm guessing that the overall performance of the calculations will be slower due to the fact that I need to calculate each tuple from .Net by calling SSAS to retrieve the scalar value, though..

    Anyways, thanks again for the workaround :)

    Regards,
    Jon
    Wednesday, January 13, 2010 5:00 PM