Exporting Editing And Importing An Environment Via A Script File [CS]



  

This Client Server article is republished in its entirety from 2003 for reference purposes.

Exporting Editing And Importing

Original Author: Bentley Technical Support Group

 

This article will demonstrate how to export an existing ProjectWise environment, edit the script (.aam) file to add more attributes, and then import the edited .aam file as a new environment.

ProjectWise environments hold a collection of document attributes that a user can view through the Attributes and More Attributes pages of the document's properties.

Environments can be created in two ways: by writing and importing script files (.aam files) or by using the Environment Editor in ProjectWise Administrator. Writing a script file requires a detailed knowledge of the format in the script (.aam) file. While editing the script file may be necessary to modify the environment, it is much easier to use the Environment Editor GUI to create a new environment.

When creating an environment, it is good practice to add more attributes than are currently required, for possible use at a later date. While you cannot add attributes to an existing environment through the Environment Editor, you can export the environment, edit the script (.aam) file, and then re-import it as a new environment.

In ProjectWise Administrator, right click on the environment you want to edit and choose Export. Save the script file with the extension .aam. Open the .aam file in an ASCII text editor, such as notepad.

Once you have the script file, there are a few sections that must be changed in order to use the script to import the file as a new environment.

At the top of the file, the table number must be changed to a higher number than your existing environments. The table name and description must also be changed and those names must be unique to the data source.

Example:

Table 8 [Change the table number here to be higher than your existing Environment's](Name = "ClientServer_Env", [Change this name to be unique to the DataSource]Description = "ClientServer_Env", [Change this one also]Type = 2)

Also within the table section you need to define any additional columns you want to add to your environment. The column section reflects the settings in the "new column properties" dialog box.

 

They should follow the following syntax: Column # ( "name", type, "native_type" );

Example:

{Column 1(Name = "ClientServer_Column1",Type = text(21),NativeType = "sql_varwchar(40)");Column 2(Name = "design_date",Type = text(21),NativeType = "sql_varwchar(10)");} [Add columns here, changing the name and column number in sequence]

Under the environment section, the DocAttrTable number must match the one used above. Also under this section the AttrDef table number and the AttrGuiDef table number must also match the one used above.

The AttrDef section of the .aam file reflects the settings in the Editing and Value tabs.

  

The AttrGuiDef section of the .aam file reflects the setting in the Interface tab, as well as the layout of the fields on the actual attributes and more attributes pages.

Example:

Gui 11 ( "ClientServer_Interface" );Environment 108(Name = "ClientServer_Env",Description = "ClientServer_Env",DocAttrTable = 8 [Change the table number here to match the one you used above]

 

){AttrDef 2(Table = 8, [Change the table number here to match the one you used above]Column = 1,FieldType = "E",EditFldFont = "Arial",EditFldFontSize = 10,Parameters = "T",DefaultValueType = "F",DefaultValue = "Not Started",DisplayLength = 0,FieldAccess = "E",ValueListType = "L"){ValueList{( "Not Started", "" ),( "In Progress", "" ),( "Complete", "" ),( "Rejected", "" )}}AttrGuiDef 1(Table = 8, [Change the table number here to match the one you used above]Column = 1,Gui = 11,PageNumber = 1,TabOrder = 1,Label = "Project Status",LabelFont = "Arial",LabelFontSize = 12,LabelX = 101,LabelY = 54,LabelDX = 142,LabelDY = 11,EditFldX = 103,EditFldY = 76,EditFldDX = 144,EditFldDY = 15,Prompt = "Enter the Status Here");}

Repeat this for each AttrDef, AttrGuiDef, and Trigger. Remember, if you are adding a field, you need to define all three components: the Column name, the AttrDef, and the AttrGUIDef.

Now that all of your edits have been made, save the file and close the text editor. In Projectwise Administrator, right click on Environments and choose import. Navigate to the file you just edited, then choose open. The .aam file gets imported and a new environment is created.

Once you import your new environment you can use the Environment Editor to tweak the settings of the attributes you added. You can adjust the default values, as well as the layout of the attributes. You can now assign folders to your new environment.

See Also

Client Server Archive

ProjectWise TechNotes And FAQs

Comments or Corrections?

Bentley's Technical Support Group requests that you please confine any comments you have on this Wiki entry to this "Comments or Corrections?" section. THANK YOU!