ChangeSynergy::CreateReportDefinition
The ChangeSynergy::CreateReportDefinition class is used with the csapi createReport API to create new Change reports based off of an already existing report.
An example of using this API:
my $csapi = new ChangeSynergy::csapi();
eval { $csapi->setUpConnection("http", "machine", 8600);
my $aUser = $csapi->Login("u00001", "u00001", "User", "\\\\machine\\ccmdb\\cm_database"); #Create an instance of the CreateReportDefinition class. my $reportDef = new ChangeSynergy::CreateReportDefinition(); #Set the required attributes. $reportDef->setName("API Created Report"); $reportDef->setBaseReport("Column"); $reportDef->setQueryString("(cvtype='problem') and (crstatus='entered')"); #Set optional attributes $reportDef->setDescription("This report was created via the Perl API"); $reportDef->setIncrementSize(7); #Only see 7 items per page. $reportDef->setFolderName("API Folder"); #Place the report into a folder named 'API Folder' #Change the list of attributes from a column report. Initial attributes are problem_number, crstatus and problem_synopsis. #Changing to just be problem_number and enterer. my @attributeLists = (); push @attributeLists, "problem_number:0:false|enterer:1:false"; $reportDef->setAttributes(\@attributeLists); #Sort first by enterer as a string and secondarily sort the problem number. my @sortOrderList = (); push @sortOrderList, "enterer:string:A|problem_number:intb:A"; $reportDef->setSortOrder(\@sortOrderList); #Create an instance of the Globals calls. my $globals = new ChangeSynergy::Globals(); #Call the 'createReport' API and add the new report to the Shared CR queries. $csapi->createReport($aUser, $reportDef, $globals->{PROBLEM_TYPE}, $globals->{SHARED_PROFILE}); }; if ($@) { print $@; }
array |
getAttributes() Gets an array of attribute configuration strings, each index into the array is for a subreport. Example string "problem_number:0:false|enterer:1:false". |
scalar |
getBaseReport() Gets the name of the base report, the report that the newly created report will be based on. |
scalar |
getDescription() Gets the description for the report. |
scalar |
getFolderName() Gets the name of the folder that the report will be created in. |
scalar |
getIncrementSize() Gets the number of items that will be displayed on a paged report, or -1 if the report is not paged. |
scalar |
getName()> Gets the name of the report to create. |
scalar |
getPromptingQueryXml()> Gets the XML data that defines how a prompting query should function. |
array |
getSortOrder() Gets an array of sort order configuration strings, each index into the array is for a subreport. Example string "problem_number:intb:A". |
scalar |
getQueryString() Gets the query string for the report. |
void |
setAttributes(array @attributes) Sets the list of attributes that will be retrieved when the report is run. Each index into the array is an attribute configuration string, "problem_number:0:false|crstatus:1:false|problem_synopsis:2:false". |
void |
setBaseReport(scalar baseReportName) Sets the name of the base report, the report that the newly created report will be based on, for example "Column" or "Block". A base report name is required when creating a new report. |
void |
setDescription(scalar description) Sets the description for this report, this is the text end users shall see in the reporting interface when they select the report. |
void |
setFolderName(scalar folderName) Sets the name of the folder that the report will be created in. If a folder name is not supplied the report will be created at the root level. |
void |
setIncrementSize(scalar incrementSize) Sets the number of items per page that should be displayed on the report. Use -1 if the report should not be a paged report. |
void |
setName(scalar reportName) Sets the name of the report that will be created on the Change server. This is the name that will appear in the reporting interface. A name is required when creating a new report. |
void |
setPromptingQueryXml(scalar reportName) Sets the prompting query XML for the report. This defines how a prompting query should function. |
void |
setSortOrder(array @sortOrder) Sets the list of sorting attributes that will be used when the report is run. Each index into the array is a sort order configuration string, "problem_number:intb:A". |
void |
setQueryString(scalar queryString) Sets the query string that will be used when the report is run. For example, (cvtype='problem') and (crstatus='assigned'). A query string is required when creating a new report. |
Initializes a newly created ChangeSynergy::CreateReportDefinition class that can be used to create a new report.
my $reportDef = new ChangeSynergy::CreateReportDefinition();
Gets an array of attribute configuration strings. Each index into the array represents a sub report. An example of an attribute configuration string is "problem_number:0:false|crstatus:1:false|problem_synopsis:2:false", this is the same kind of string as you would see in a standard configuration entry for a CCM_PROBLEM, CCM_TASK or CCM_OBJECT definition.
Returns: array of scalars An array of attribute configuration strings.
Gets the name of the base report. A base report is the report that this report shall be based off, for example "Column" or "Block".
Returns: scalar The name of the base report.
Gets the description for the report. The description is visible in the Change reporting interface when the user clicks on the report.
Returns: scalar The description of the report.
Gets the name of the folder where the new report should be placed. If empty then it will not be placed into a folder.
Returns: scalar The name of folder where the report will be created.
Gets the number of items that will be displayed on a paged report. If the return value is -1 that means the report is not a paged report.
Returns: scalar The number of results to show on a page or -1 if not a paged report.
Gets the name of the report, this is the name that users shall see in the Change reporting interface.
Returns: scalar The name the report will have on the change server.
Gets the prompting query XML data.
Returns: scalar The prompting query data in XML format.
Gets an array of sort order configuration strings. Each index into the array represents a sub report. An example of a sort order configuration string is "problem_number:intb:A", this is the same kind of string as you would see in a standard configuration entry for a CCM_PROBLEM, CCM_TASK or CCM_OBJECT definition.
Returns: array of scalars An array of sort order configuration strings.
Gets the query string for the report.
Returns: scalar A query string.
Sets the list of attributes for each subreport that will be retrived when the report is run. Each index into the array represents an attribute configuration string for each subreport. The string that must be set is attribute name:order:span. For example, "problem_number:0:false|crstatus:1:false|problem_synopsis:2:false".
The passed in parameter must be an array reference, \@array.
This setting should only be used for ad hoc report types and not system or report builder reports as their format is hard coded and cannot change dynamically.
Parameters: array reference attributes: A reference to an array of attribute configuration strings.
Example: my $reportDef = new ChangeSynergy::CreateReportDefinition(); my @attributeLists = (); push @attributeLists, "problem_number:0:false|enterer:1:false"; $reportDef->setAttributes(\@attributeLists);
Sets the name of the base report, the report that this newly created report shall be based on. The base report must already exist on the Change server. Examples of possible base reports are "Column" and "Block".
This parameter must be set in order for the csapi->createReport function to work.
Parameters: scalar: The name of the base report.
Example: my $reportDef = new ChangeSynergy::CreateReportDefinition(); $reportDef->setBaseReport("Column");
Sets the description for the report, the text end users will see in the Change reporting interface.
Parameters: scalar: The description for the report.
Example: my $reportDef = new ChangeSynergy::CreateReportDefinition(); $reportDef->setDescription("All entered CRs");
Sets the name of the folder the report will be created in. If the folder does not exist an attempt will be made to create the folder. If no folder name is specified the report will be created in the root folder.
Parameters: scalar: The name of the folder to place the report in or empty for no folder.
Example: my $reportDef = new ChangeSynergy::CreateReportDefinition(); $reportDef->setFolderName("API Folder");
Sets the number of items per page that should be displayed in the report results. Specify -1 to indicate that this report will not use paging.
Parameters: scalar: The number of items to see per page or -1 for no paging.
Example: my $reportDef = new ChangeSynergy::CreateReportDefinition(); $reportDef->setIncrementSize(20);
Sets the name of the report, this is the name end users shall see and interact with in the Change reporting interface. If the report name already exists the name shall become "report name (x)" where x is the first free number. This is the same naming scheme that is used in the web interface.
This parameter must be set in order for the csapi->createReport function to work.
Parameters: scalar: The name this report shall have upon creation.
Example: my $reportDef = new ChangeSynergy::CreateReportDefinition(); $reportDef->setName("API report");
Sets the prompting query XML data for the report. It is best to create prompting reports via the interface or by exporting and importing an existing report. Only set this setting if you know the XML format.
Parameters: scalar: The XML data that defines a promting query.
Example: my $reportDef = new ChangeSynergy::CreateReportDefinition(); $reportDef->setPromptingQueryXml(XML DATA);
Sets the list of sorting attributes for each subreport that will be used to sort the report when it is run. Each index into the array represents a sort order configuration string for each subreport. The string that must be set is attribute name:sort type:A or D. Where A or D stands for ascending or descending. An example string is "problem_number:intb:A".
The passed in parameter must be an array reference, \@array.
Parameters: array reference attributes: A reference to an array of sorder order configuration strings.
Example: my $reportDef = new ChangeSynergy::CreateReportDefinition(); my @sortOrderList = (); push @sortOrderList, "enterer:string:A|problem_number:intb:A"; $reportDef->setSortOrder(\@sortOrderList);
Sets the query string that will be used when the report is run.
This parameter must be set in order for the csapi->createReport function to work.
Parameters: scalar: The query string.
Example: my $reportDef = new ChangeSynergy::CreateReportDefinition(); $reportDef->setQueryString("(cvtype='problem') and (crstatus='entered')");