Place a Debug COMate_GetLastErrorDescription() after each method / property call then.
If the problem is the objADOMD\SetPropertyRef("ActiveConnection = "+Str(objMDX)+" as COMateObject") line then I suspect that the server wants an indirect pointer to the iDispatch object. If this is the case then we will need to modify the code - but first you need to confirm that this is the problem line (with some Debug COMate_GetLastErrorDescription() lines)!
My OLE viewer tool tells me that we definitely need to be using SetPropertyRef() here.
Code: Select all
IncludePath "..\"
XIncludeFile "COMatePLUS.pbi"
Define.COMateObject objMDX, objADOMD
objMDX=COMate_CreateObject("ADODB.Connection")
If objMDX
objADOMD=COMate_CreateObject("ADOMD.Cellset");catalog
If objADOMD
vCube.s = "zxCube"
vCompany.s = "[Company].[Company 200].[Level 1].&[200]"
vCurrency.s = "[Currency].[Currencies].[EUR]"
vCustomer.s = "[Customer].[Customers].[All]"
vDatasource.s = "[DataSource].[DataSources].[DMC]"
vGCN.s = "NET"
vMEALTYPE.s = "[METALTYPE].[METALTYPES].[ALL]"
vProdLine.s = "[PRODLINE].[ProdLines].[Level 3].&[3]"
vPeriod.s = "P4"
vYear.s = "2009"
vForeCastType.s = "1"
mdx.s = "with "
mdx.s = mdx.s + "member [Act1] as ([Measures].[Periodic],[Scenario].[Scenarios].[ACT],[Time].[YM].[Month].[P1 " + vYear + "]) "
mdx.s = mdx.s + "select [Act1] on columns, [Account].[Accounts].[304] on rows from "
mdx.s = mdx.s + "( select {" + vCompany + "} on columns from "
mdx.s = mdx.s + "( select {" + vProdLine + "} on columns from "
mdx.s = mdx.s + "( select {" + vCustomer + "} on columns from "
mdx.s = mdx.s + "( select {" + vMEALTYPE + "} on columns from "
mdx.s = mdx.s + "( select " + vDatasource + " on columns from "
mdx.s = mdx.s + "( select " + vCurrency + " on columns from "
mdx.s = mdx.s + "( select [GCN].[GCN].[" + vGCN + "] on columns from "
mdx.s = mdx.s + "( select [TCurrency].[Switch].&[TCurrency] on columns from "
mdx.s = mdx.s + "[" + vCube + "] )))))))) cell properties value "
If objMDX\Invoke("Open('Provider=MSOLAP.3;Data Source=DB.server.com;Initial Catalog=FIBI;')") = #S_OK
objADOMD\SetProperty("Source = '"+mdx+"'")
Debug COMate_GetLastErrorDescription()
objADOMD\SetPropertyRef("ActiveConnection = "+Str(objMDX)+" as COMateObject")
Debug COMate_GetLastErrorDescription()
objADOMD\Invoke("Open")
Debug COMate_GetLastErrorDescription()
Debug objADOMD\GetIntegerProperty("(0,0)")
Else
Debug COMate_GetLastErrorDescription()
EndIf
objADOMD\Release()
Else
Debug "Could not instantiate the ADOMD.Cellset object"
EndIf
objMDX\Release()
Else
Debug "ADODB.Connection"
EndIf