Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cognos Script/Macro to open model and create cube

Status
Not open for further replies.

u253458

Programmer
Jun 4, 2003
21
0
0
US
I need to automate the cube build process. The models for these cubes have User class security applied to them. So I cann't make the direct calls to transformer to build cubes.

I am looking for some macro script to open an existing model with access manager security in the then and then create cube.

Thanks
 
YOu can try this. Be careful of the line breaks.

Sub Main

Dim objTrans as Object
Dim objModel as Object
Dim objCube as Object
Dim strModelName as String
Dim strPath as String
Dim strModel as String
Dim strCubeName as String

'*** File names and path(s) ***
strPath = "E:\"
strModelName = "secured_model.pyi"
strModel = strPath & strModelName

'*** Open model inside Transformer 7 ***
Set objTrans = CreateObject ("CognosTransformer.application")
Set objModel = objTrans.OpenModel(strmodel,"Administrator","Password","Root User Class")
Set objCube = objModel.Cubes.Item(1)

'*** Builds Cube ***
objCube.CreateMDCFile

End Sub
 
Thanks flex13.

I used this script/macro.But I get this error

TR1906 - Power Data server cann't be started.verfify environment variables.

Do you know anything about this error message?

Also, Is this macro/code, assuming the that the transformer is on the server. In my case, I want to use the transformer installed on my m/c

Thanks
 
Are you trying to build a cube remotely? You will have to run this on the server where Transformer is installed.
 
Hi,

Yes, I am trying to build this cube remotely.

Is there any way, I can use script/macro to build cubes from my local workstation?

Thanks,

Sanjay Gupta
 
You will have to run the script on ther server where Transformer is installed. If your model specifies that it should be built on a remote server, then you will have to make a copy of the model and change it to build locally.
 
Hi flex13,

I will try to explain again what I am trying to do

1. The models are set to build cubes locally (not for server). In the Models, I had added UserClass security Access.

So When I try to build cube, using these models, just by calling trnsfer.exe in bat. Because of User Class security(Access Manager), I get the Access common logon window, asking for user id and password. If I enter useid/password, cubes build process works fine.

Now, I want to automate my cube build process without worrying about someone restart/reboot our workstation and forgetting to logon to access manager tool. To automate this cube build process, somehow, either I have to logon to access manger common logon application. So I think, If I use macro/script to build cube and also pass logon/userid to model, it should solve my problem. But for reason, in the macro you suggested, I get error at this statement

Set objModel = objTrans.OpenModel(strmodel,"Administrator","Password","Root User Class")

R440: Autoexe: Tr1906: PowerPlay Date server can't be started. Verify Environment variables.
I am using Cognos Version 6.6.

I am not sure, what this error really means.

I don't want to use the transfomer on the server.

Anyhelp would be greatly appreciated.

Thanks,


 
Sanjay,
I am working on this same issue and have been receiving a similar error @ this line : SetobjModel=objTransApp.OpenModel(strModelSource)
R440 "AutoExe: (TR2610) Transformer can't open the model." Is the error that I am getting. Did you ever find a solution to this problem? Please let me know if so ! Thanks.
 
I used this script/macro.But I get this error

raised exception class EoleException with message 'trCube'(CreateFile):(TR1901)
1.PowerPlay Data Server can't read the PowerCube(Close PowerCube) in f:\cognos\work\test.mdc
2.could not save file in f:\cognos\work\vip\test.mdc
 
Hi gnixnew; this error comes from opening the cube after it is built within the place you built it. delete this .mdc before building it again, and the error should go away, however, when you are done, do not open this mdc from this location, instead, copy the .mdc to another location for so to speak " viewing cubes" area. Then, it won't give you this error the next time you build it. And, you won't have to delete the mdc every build.

1.PowerPlay Data Server can't read the PowerCube(Close PowerCube) in f:\cognos\work\test.mdc
2.could not save file in f:\cognos\work\vip\test.mdc
========================================================
U25343;
"TR1906 - Power Data server cann't be started.verfify environment variables."

Now, this is a different issue. Your Transformer is not set up to do this.
==========================================================

MDUGGAL;

This error, "(TR2610) Transformer can't open the model.", usually means that the model file is not being read properly. Can you open this manually? Is it on the same box as when you test the script?
=========================================
wheww

CP [cook]
 
thanks everybody!!
hi! cognosProfessional ;
i try to do what your said.
in my programm, built *.mdc in one location ,"viewing cubes" is another location, i have been realized the copying method , make the program ,it is ok, but the program "Run - time" show the error : "autoexe.exe Application is error."
open transformer->file->preference->Directory->data temp files ,view the saved location,created many unknown and unread files in the location (maybe error log or error temp file). what's wrong with it?
 
Hi Sanjay & Guys

Did u get the solutions for this ????

Tell me Which Version of Tranformer Using??

Here u r creating the instance of Cognos Transformer... isnt it??

Set objTrans = CreateObject("CognosTransformer.application")

Wher u have installed Tranformer i.e cer2,cer1,cer3. Directory.

If u have installed Transformer in cer3. U have to set the instance of the Transformer to the object.

Set objTrans = CreateObject("CognosTransformer.application.cer3")

I hope this works..


Regards

Macintosh




 
Hey Everyone.
This is what I have so far,however I am getting the following error at this line :
objmodel.CreateMDCFiles , a msg box that states the server is busy appears. The message box states : Action cannot be completed because the other program is busy. Choose "Switch To" to activate the busy program and correct the program.

Does anyone know how to resolve this?

Just as a general FYI, I am using a batch file and a macro to disable the cube, rebuild the cube, copy the new cube and then enable the cube. The purpose of the macro is to build the cube and logon to the Common Logon Server.


Sub Main()
'declare variables
Dim objTransApp as Object
Dim objModel as Object
Dim objDrill As Object
Dim objAssociation As Object
Dim objColumn As Object
Dim strModelPath As String
Dim strLocation As String
Dim strModelSource As String

strLocation = "INSERT Cube Location Path"
strModelSource = "INSERT PYI file "
strModelPath = strLocation & strModelSource

Set objTransApp = CreateObject("CognosTransformer.application.cer3")
Set objModel=objTransApp.OpenModel(strModelPath ,"Administrator", " INSERT Password" , "Root User Class")

'build Cube
objmodel.CreateMDCFiles
objModel.close

Set objColumn = Nothing
Set objAssociation = Nothing
Set objDrill = Nothing
Set objModel = Nothing
Set objTransApp = Nothing
End Sub
 
mduggal,
the message you get is merely indicating that the macro editor is in run mode and busy executing the line concerned. Until it reaches the end of the macro or generates an error, it will remain in that state.
The log file for the cube should indicate what state transformer has reached in building your cube(s).
When testing macros, it's sensible to set the model concerned to just do a small build to save time.

lex
 
Thanks for the info Lex, turns out the script above works perfectly fine however you have to add the following code at the top of the MDL file to embed login. This works while using v. 7.0.


Name "cswi all" AutoAccess False Synchronize False SynchroCycle 0 SynchroStamp 0
UpdateCycle 77 ModelStamp 951340222 ClientStamp 951340222 ServerStamp 0
Generation 1245184 RootUser 1368474787 Version "7.0.705.0 " AccessManager True
AccessManagerLogin "XXXXXXXX" AccessManagerNameSpace "Default"
AccessManagerPassword "XXXXXX" AccessManagerUserClasses True AccessManagerUserClass "Root User Class"


 
mduggal,
no problem; I had thought that since your script had the words "INSERT PYI file", you were using a .pyi file for the build, which embeds signons, and that you were working as a user "signed in" to the namespace.
See a recent thread here about .pyi vs .mdl use.
lex
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top