dbTalk Databases Forums  

calling .net assembly com componets using USE LIBRARY statement

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss calling .net assembly com componets using USE LIBRARY statement in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
santosh
 
Posts: n/a

Default calling .net assembly com componets using USE LIBRARY statement - 11-17-2003 , 07:03 AM






Hello All,
I have following class defined in c#.

[Guid("8C6B52B0-5081-4a96-88EC-5F99124FAB68"),ProgIdAttribute("MyFunctionExt
ender")]
public class FunctionExtender
{
public bool Like(string PatternString, string MatchString)
{
return PatternString.Equals(MatchString);
}
}

I want to call "Like" function from the mdx.

Here for interoperability I run RegASM tool to register the COM componets
with the tlb option set .

Then I try to use the following statements in the
in Mdx sample application that comes with Analysis service installation.

USE LIBRARY "<dll path name>\<myAsseembly.dll>"

but above statement thows up a dialog box saying path name not found.

then I tried
USE LIBRARY "<dll path name>\<myAsseembly.tlb>"

This stament executed sucessfully
Then I tried using "Like" function in the mdx functions as

select { [Measures].[<MyMeasure1>] } on columns,
{filter([MyDimension].Members,
MyFunctionExtender!Like([company1].CurrentMember, "abc") = true )} on rows
from CenterBeamOlap

This throws exception with message "!MyFunctionExtender!Like" not found.
What should I use for function scoping. As per the UDF help, I am using
ProgramID to do scoping.

Obviously I am missing something here . Can anyone point me to the solution.

One more interesting thing I observed that registration of the above tlb
from "Register" Dialog Box of "Calculated Member" from Analysis Server
Manager Application thows up a message saying that path could not be found.
Obvivously file is present at the given path since I select the tlb file
from the Dialog Box.

thanks
Santosh



Reply With Quote
  #2  
Old   
Irina Gorbach [MS]
 
Posts: n/a

Default Re: calling .net assembly com componets using USE LIBRARY statement - 11-17-2003 , 10:31 PM






Hello Santosh,
Part of the problem could be that regasm.exe registers component in the
registry in a bit different way, that AS can not handle, that is why
registration from Analysis Manager doesn't work.
As for function scoping, you should use
TypeLibraryName!InterfaceName!FunctionName. Note that InterfaceName is not
the same as ClassName, for example in VB it is _ClassName.

--
Hope this helps,
Irina

---------------------------
Disclaimer: This posting is provided 'AS IS' with no
warranties, and confers
no rights.

"santosh" <santoshgujar (AT) ureach1234 (DOT) com> wrote

Quote:
Hello All,
I have following class defined in c#.


[Guid("8C6B52B0-5081-4a96-88EC-5F99124FAB68"),ProgIdAttribute("MyFunctionExt
ender")]
public class FunctionExtender
{
public bool Like(string PatternString, string MatchString)
{
return PatternString.Equals(MatchString);
}
}

I want to call "Like" function from the mdx.

Here for interoperability I run RegASM tool to register the COM componets
with the tlb option set .

Then I try to use the following statements in the
in Mdx sample application that comes with Analysis service installation.

USE LIBRARY "<dll path name>\<myAsseembly.dll>"

but above statement thows up a dialog box saying path name not found.

then I tried
USE LIBRARY "<dll path name>\<myAsseembly.tlb>"

This stament executed sucessfully
Then I tried using "Like" function in the mdx functions as

select { [Measures].[<MyMeasure1>] } on columns,
{filter([MyDimension].Members,
MyFunctionExtender!Like([company1].CurrentMember, "abc") = true )} on rows
from CenterBeamOlap

This throws exception with message "!MyFunctionExtender!Like" not found.
What should I use for function scoping. As per the UDF help, I am using
ProgramID to do scoping.

Obviously I am missing something here . Can anyone point me to the
solution.

One more interesting thing I observed that registration of the above tlb
from "Register" Dialog Box of "Calculated Member" from Analysis Server
Manager Application thows up a message saying that path could not be
found.
Obvivously file is present at the given path since I select the tlb file
from the Dialog Box.

thanks
Santosh





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.