If you are unable to create a new account, please email support@bspsoftware.com

 

Calling cubeswap.bat in cognos script and passing cube name in a variable

Started by techieaman, 25 Jan 2007 11:07:13 AM

Previous topic - Next topic

techieaman

Hi All,

I have a typical problem where my cubes have to be published on Cognos 8 portal. Each time the cube will be refreshed through a macro it will contain a new name in terms of a timestamp suffix. Through cubeswap.bat I want to point my portal data source connection to point to the refreshed cube.

It is kinda difficult to pass the new cube name in a variable in a bat file and use cubeswap. So i tried to call the cubeswap.bat with parameters within the macro through the shell function.

But, i am unable to do that .compliation errors are encountered at shell function. Can anyone suggest a way to remove the errors. Or any other way anyone has attempted the cube refresh in cognos 8.

My macro is as follows:


Sub Main

Dim objTransApp As Object
Dim objModel as Object
Dim objCube as Object
Dim strModelName as String
Dim strPath1 as String
Dim strPath2 as String
'Dim strModel as String
Dim strCube as String
Dim strCubeName as String
dim timestamp as String
Dim strModelPath As String
Ã,  Dim strLocation As String
Ã,  Dim strModelSource As String
Ã,  Dim newCubeName as String
Ã,  dim x
Ã, 
strLocation = "D:\Cognos\Model\Monthly_Sales\"
Ã,  strModelSource = "SalesModel.pyi"
Ã,  strModelPath = strLocation & strModelSource
Ã, 
timestamp = format(now,"ddmmyyyy_hhmmss_AM/PM")

'File names
strPath1 = "D:\Cognos\Cubes\"
strPath2 = "D:\Cognos\Cubes\Refresh_Cube\"
strModelName = "SalesModel.pyi"
strCube = "salescube.mdc"
newCubeName = "salescube"
'strModel = strPath1 & strModelName

'Creates new cube name

strCubeName = newCubeName & "_" & timestamp & ".mdc"

'Open model
Set objTransApp = CreateObject ("CognosTransformer.application.cer4")
Set objModel = objTransApp.OpenModel (strModelPath)
Set objCube = objModel.Cubes.Item(1)

'Build Cube
objCube.CreateMDCFile

'Rename cube
FileCopy strPath1 & strCube, strPath2 & strCubeName

x = shell(D:\program files\cognos\c8\webapps\utilities\cubeswap

cubeswap.bat -dispatchername="http://micv92:9300" -datasource="test123"

-url="http://micv92:9300/p2pd/servlet/dispatch"

-windowscube=strCubeName -username="c8administrator"

-password="cog01nos" -namespaceid="Default",1)

objModel.Close

Ã,  Set objCube = Nothing
Ã,  Set objTransApp = Nothing
Ã,  Set objModel = Nothing

Ã,  MsgBox "Refreshed Sales Cube has been created"

End Sub



Please suggest a solution soon.

Thanks and Regards,

Aman Anand

techieaman

Hello All,

I have been able to sort this issue out with help from Cognos Support.

Thanks and Regards,

Aman

ZiggityZack

What resolution did they provide?

Quote from: techieaman on 30 Jan 2007 09:22:16 AM
Hello All,

I have been able to sort this issue out with help from Cognos Support.

Thanks and Regards,

Aman

techieaman

Hi,

They helped in sorting the problem with my macro.

Regards,

Aman

COGNOiSe administrator

Thanks for nothing, techieaman. We are here to help each other remember? You are not going to tell us what was the problem with your macro? If I had to guess I'd say the space between program and files was the issue, but I'm just speculating.

techieaman

Hi

Apologies for my delayed response.  Problem was a bit weird as cubeswap was not working. Reason was the shell command unable to get into the d directory to pick the cubeswap utility.

So for this we added a line of code before getting to the cubeswap utility for changing the directory to D.

Which worked!

I hope this answers everyone's query.

If anybody needsthe macro just mail me on anandaman@gmail.com

Thanks again.

Regards,

Aman