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