Question
· Apr 26, 2017

%Installer

Hi ,

We are trying to import file using %installer . But we are getting error.

CODE:

Include %occInclude Class User.InsClass { // You can see generated method in zsetup+1^App.Installer.1 XData Install [ XMLNamespace = INSTALLER ] { Flags="ck" IgnoreErrors="0"/> } // Entry point method, you need to call // At class compile time it generate Caché ObjectScript code from the manifest // After that you can run this installer from a terminal: // Set pVars("Namespace")="NewNamespace" // Set pVars("SourceDir")="C:\temp\distr\" // Do ##class(User.InsClass).setup(.pVars) ClassMethod setup(ByRef pVars, pLogLevel As %Integer = 0, pInstaller As %Installer.Installer) As %Status [ CodeMode = objectgenerator, Internal ] { Quit ##class(%Installer.Manifest).%Generate(%compiledclass, %code, "Install") } }

ERROR :

%SYS>Do ##class(User.InsClass).setup(.pVars)
2017-04-26 17:43:56 0 User.InsClass: Installation starting at 2017-04-26 17:43:56, LogLevel=0
2017-04-26 17:43:56 0 : SourceDir defined - offline install from C:\temp\distr\
 
Load started on 04/26/2017 17:43:56
 
ERROR #5012: File 'C:\temp\distr\text' does not exist
Detected 1 errors during load.
2017-04-26 17:43:56 0 User.InsClass: ERROR #5012: File 'C:\temp\distr\text' does not exist
2017-04-26 17:43:56 0 User.InsClass: Installation failed at 2017-04-26 17:43:56
2017-04-26 17:43:56 0 %Installer: Elapsed time .027753s
 

Could anyone help us and let us know how to import and export file using %installer . 

Discussion (5)1
Log in or sign up to continue

Did you see my answer above? Did you look at using the ExportAllClasses method of %SYSTEM.OBJ to write a file? And then use the Import method from within another namespace to load the contents of that file?

To help you get started, here's me running the first step:

SAMPLES>s sc=$system.OBJ.ExportAllClasses("c:\s\samples-allclasses.xml")
 
Exporting class: Aviation.Aircraft
Exporting class: Aviation.Classification.Utils
Exporting class: Aviation.Crew

...

Also, you may find the "Add new comment" links in Developer Community useful, instead of posting answers that are really questions. For example:

Please also be aware that you can mark one answer to your question as "accepted" by clicking on that checkmark you see in my screenshot above.

Hi , 

I would like to know if there is any program to export multiple class files from studio's one namespace to another  without specifying classname.  As in case of Import where we just specify the import tag as given below.

    <Namespace Name="${Namespace}" Create="no">
        <CSPApplication Url="/csp/${Namespace}" Directory="${CSPDIR}${Namespace}" AuthenticationMethods="64" IsNamespaceDefault="true" Grant="AppRole" />
        <IfDef Var="SourceDir">
            <Log Text="SourceDir defined - offline install from ${SourceDir}" Level="0"/>
            <Import File="${SourceDir}"/>
        </IfDef>
    </Namespace>
    

Regards,

Arpitha R