<% // Adds a folder given a parent ID. If the parent ID is 0, the folder
// is added to the top level. %>
<!-- #include file=RetrieveIStore.csp -->
<!-- #include file=helper_js.csp -->
function AddFolder(ParentFolderID, FolderName, FolderDescription, InfoStore)
// The ID of the folder's parent folder.
// A description of the folder.
// The InfoStore used to communicate with the server.
// Returns the ID of the newly created folder
// If the function fails, it returns zero.
// Since folders are implemented using a plugin
// you will need the PluginManager to retrieve the folder plugin.
pmgr = InfoStore.PluginManager;
// Retrieve the Report plugin by passing the plugin's ProgID
// to the PluginInfo property of the PluginManager.
FolderPlugin = pmgr.PluginInfo("CrystalEnterprise.Folder");
// Create a new, empty InfoObject collection.
NewCollection = InfoStore.NewInfoObjectCollection();
// Give the Folder plugin object to the Add method. This
// creates a new InfoObject based on the plugin type.
// In this case, since the plugin is the folder plugin,
// the object created is a folder object.
NewFolder = NewCollection.Add(FolderPlugin);
// Specify the folder's details.
NewFolder.Description = FolderDescription;
// The next line indicates where in the folder tree the
// folder is to be created. It does this by setting the
// parent ID property or, in other words, by telling the folder
// which folder is its parent. If the parent ID property is
// zero, then the folder has no parent and is thus a top
NewFolder.Properties.Add ("SI_PARENTID",ParentFolderID);
//NewFolder.ParentID = ParentFolderID
// Use the InfoStore to commit the new collection with the new folder
InfoStore.Commit (NewCollection);
// If the function failed return zero.
// Return the new folder's ID. The ID is assigned by the APS
// once the folder has been created.
// The main subroutine in the file. It logs on to the APS, retrieves the
// folder description, folder name and adds the folder. It then adds a folder
// beneath the folder that was just added.
// The InfoStore object used to query the APS.
// The name of the folder to be added.
// A description of the folder.
// Logon and retrieve InfoStore.
Response.Redirect ("Start.csp");
FolderName = Request.Form.Item ("FolderName")
FolderDescription = Request.Form.Item ("FolderDescription")
NewFolderID = AddFolder( 0, FolderName, FolderDescription, IStore);
Response.Write ("Top
if (AddFolder(NewFolderID,"Subfolder of " + FolderName, "",IStore) != 0 ) {
Response.Write ("Subfolder added.");
Response.Write ("Subfolder not added");
Response.Write ("Folder not added");
Crystal Decisions, Inc. http://www.crystaldecisions.com Support services: http://support.crystaldecisions.com |