Description:
I am trying to upgrade the Mart, but would like to save the models manually. Is there a way to extract models from Mart and save them externally?
Solution:
Yes, you can do so by running the scripts (one for Mart r8 and the other for Mart r9) attached to this article. These are javascripts that allow a user to export models from an r8/r9 Mart automatically to a local drive. These also retain the library structure, i.e. the models are saved in the folder as specified in the script, but it will also create the sub-folders with the Library / Catalog names and save the models under their respective sub-folders.
To use the r8 script:
Please change these parameters in the attached script:
1st line in script -----var credentials = "?SRT=SQL Server 2005/2008 (using native ODBC);TRC=NO;SRV=xxxxxxxxxx;UID=sa;PSW=xxxxxxx"; //user has to provide connection parameters including the SRT, UID and PWD
2nd line in script----- var location="mmart://Mart"; (this should be the root mart name)
6th line in script-----------var root="C:\\"+ mart.name; (local drive to save the models in)
To use the r9 script:
Please change these parameters in the attached script:
1st line in script ------------ var credentials = "?TRC=NO;SRV=localhost;PRT=18170;ASR=MartServer;UID=xxxxxx;PSW=xxxxxxx"; //user has to provide connection parameters including SRV, UID and PWD
2nd line in script------------ var location="mart://Mart"; (this should be the root mart name)
6th line in script-----------var root="C:\\"+ mart.name; (local drive to save the models in)
NOTE: In some cases, you may see the following error (figure 1):
Figure 1.
The error encountered is not related to any parameters in the java script. What is happening is the routine is not creating a SCAPI object (i.e. ERwin9.SCAPI) on that machine. We must confirm whether erwin DM 32-bit is installed on a 64-bit OS machine or erwin DM 64-bit is installed on a 64-bit OS machine.
To confirm whether the error is due to an Object creation problem or a problem with the parameters in JS file, please execute the attached ‘.txt’ file (rename it as ‘.js’ file format and double click on it ). If the WShell script throws an error message ‘ActiveX Component can’t create an object’ then it is a SCAPI Object creation problem in that machine (Before executing the ‘.js’ script, make sure that a ‘Temp’ folder exists under C:\).
There are two ways to resolve SCAPI Object creation problem:
1 If the user uses erwin DM 32-bit installed on 64-bit OS:
- Execute the attached ‘64bit reg code.reg’ script by right-clicking on it and select the ‘Merge’ option
- Execute the attached ‘.js’ file (convert attached .txt file into .js).
- If you are still getting the ActiveX Component error then please follow the below steps as mentioned in Point 2.
2 If the user uses erwin 64bit installed on 64bit OS:
Enable all the ActiveX controls and plug-in options and the ActiveX Script files permissions should then be enabled. This tab may be selected by running Internet Explorer then clicking on Tools | Internet Options as shown in figure 2 (it is for IE, but you may look into the settings menu for the web browser you are using).
Figure 2.
Select the ‘Security’ tab and select the ‘Enable’ option for all “Active X controls and Plugins” and also for the “Scripting” related options including those shown in Figure 3:
Figure 3.
Now execute the ‘.js’ file again to confirm whether the SCAPI object is created or not. If that is not being created, windows will throw an error message ‘Active X can’t create an Object’. If it is being created, it will execute and save the model 'Testcase1-LP.erwin' under the ‘C:\Temp’ folder.
NOTE: This website offers suggestions on how to run a java script: https://www.quora.com/How-do-I-run-JavaScript-code
Comments
2 comments
Hi Ernst,
To save the model as XML go to File | Save As and then in the dropdown choose XML Standard (*.xml).
Best Regards,
Matt
Hi Ernst,
Sorry, we do not have a script that will save the models as filetype 'XML Repository (*.XML) instead of as an erwin file. Please log an enhancement request that we provide a script to save the models as filetype 'XML Repository (*.XML) instead of as an erwin file. See https://erwinhelp.zendesk.com/hc/en-us/articles/233064628-How-to-Submit-an-Idea-or-Enhancement-Request-for-your-erwin-Inc-product
Best Regards,
Matt
Please sign in to leave a comment.