DeepSee Implementation Guide
Other Export/Import Options
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Class Reference   
Search:    

This appendix describes additional options for exporting and importing DeepSee elements, as a supplement to the chapter Packaging DeepSee Elements into Classes.” It discusses the following topics:

Note:
This appendix assumes that you are familiar with the process of exporting from and importing into Studio. If not, see Using Studio.
Creating a DeepSee Container Class
As noted in the chapter Packaging DeepSee Elements into Classes,”you can package pivot tables and other folder items into Caché classes. You can package as many elements as needed into a single class, which is easier to export and import than many separate files.
To create such a class:
Include as many XML definitions as needed within <items>. You can copy the definitions in Studio or from exported XML files. Also see the next section, which describes edits you should make.
Also be sure to copy and paste only the definition, not the XML declarations at the top of the file. That is, do not copy the following line into the XData block:
<?xml version="1.0" encoding="UTF-8"?>
For example:
Class DeepSee.Model.DashboardItems Extends %DeepSee.UserLibrary.Container
{

XData Contents [ XMLNamespace = "http://www.intersystems.com/deepsee/library" ]
{
<items>
<dashboard dashboard definition here ...
</dashboard>
<dashboard another dashboard definition here ...
</dashboard>
<pivot pivot definition here ...
</pivot>
<pivot another pivot definition here ...
</pivot>
<pivot yet another pivot definition here ...
</pivot>
</items>
}

}
When you compile this class or when you call its %Process() instance method, DeepSee creates the items defined in the XData block. Specifically, it imports these definitions into the internal global that the User Portal uses.
The same class can also define the %OnLoad() callback, which can execute any additional code needed when these items are set up.
For samples of pivot tables and dashboards that are packaged into class definitions, see the classes DeepSee.DashboardsEtc and HoleFoods.DashboardsEtc in the SAMPLES namespace.
If you delete a container class, that has no effect on the pivots and dashboards that currently exist.
Exporting and Importing Folder Items
This section describes the older API for exporting and importing folder items.
Exporting Folder Items Programmatically
To export folder items programmatically, use the following command:
Do ##class(%DeepSee.UserLibrary.Utils).%Export(itemname,filename)
Where:
For example:
 set DFIname="Chart Demos/Area Chart.pivot"
 set filename="c:/test/Chart-Demos-Area-Chart-pivot.xml"
 do ##class(%DeepSee.UserLibrary.Utils).%Export(DFIname,filename)

 set DFIname="KPIs & Plugins/KPI with Listing.dashboard"
 set filename="c:/test/KPIs-Plugins-KPI-with-Listing-dashboard.xml"
 do ##class(%DeepSee.UserLibrary.Utils).%Export(DFIname,filename)
Alternative Technique (for Exporting Multiple Items)
To export multiple items programmatically into a single XML file, use the $system.OBJ.Export() method. The first and second arguments for this method are as follows:
For example:
 set items("Chart Demos-Area Chart.pivot.DFI")=""
 set items("Chart Demos-Bar Chart.pivot.DFI")=""
 set items("Chart Demos-Bubble Chart.pivot.DFI")=""
 set filename="c:/test/Chart-Samples.xml"
 do $system.OBJ.Export(.items,filename)
You can also use this method to export other items such as classes; for details, see the Class Reference for %SYSTEM.OBJ.
Importing Folder Items Programmatically
To import folder items programmatically:
 Do ##class(%DeepSee.UserLibrary.Utils).%Import(pFile, pReplace, pVerbose)
Where:
For example:
 set filename="c:/test/Chart-Demos-Area-Chart-pivot.xml"
 do ##class(%DeepSee.UserLibrary.Utils).%Import(filename,1,1)