Question
· Nov 20

Create class export file from local .cls file

I have a locally saved multiple saved .cls file. How can I bundle them together as a XML file programmatically (ObjectScript) so that I can import in the next environment. Does anyone have a sample code?

Product version: IRIS 2024.2
Discussion (5)5
Log in or sign up to continue

To programmatically bundle multiple locally saved .cls files into a single XML file for importing into another environment, you can use the $System.OBJ.Export() method. Below is an example approach:

  1. Define the list of class files you want to export:

    Set fileList("YourClass1.cls") = ""
    Set fileList("YourClass2.cls") = ""
    
  2. Use $System.OBJ.Export() to export the files:

    Set result = $System.OBJ.Export(.fileList, "YourExportFilename.xml")
    

Alternatively, you can export all classes in a namespace or a package:

Set result = $System.OBJ.Export("YourPackage.*.CLS", "ExportedClasses.xml")

Or export multiple packages:

Set result = $System.OBJ.Export("Package1.*,Package2.*", "SolutionExport.xml")

Remember to check the returned status (result) to ensure that the operation was successful [1][2][3].

Sources:

Thanks for the responses. I apologize if I didn't put my question correctly. If I need to export class from the intersystems development server the below methods will work. I do not want to export directly from the server. Let us consider the following scenario.

I am using SVN for my source control management.

I am working on 2 requirement and needs to edit Transform.cls

First I make some changes on Transform.cls and check into SVN with version 100

I continue to work on the same class and check into SVN with version 101

Now I want to deploy my code for requirement 1 which is version 100.

If I export from my Dev version then it will bring only the latest change which I do not want.

I created a script to pull the version 100 using the tag I created. 

Now I have the locally saved the Transform.cls file and create the XML file.