ChangeSynergy::QueryEntry
The ChangeSynergy::QueryEntry class is used as part of a set of classes when a report is imported or exported from the server. All ReportEntry objects contain a QueryEntry object and one or more SubReportEntry objects. These set of objects make up a standard Change report configuration entry. This class represents a CCM_QUERY entry as shown below for the 'Basic Summary' query.
[CCM_QUERY] [NAME]All CRs[/NAME] [QRY_STRING]cvtype='problem'[/QRY_STRING] [DESCRIPTION]All CRs in the database. (CAUTION: This could be a large list)[/DESCRIPTION] [/CCM_QUERY]
Example:
eval { $csapi->setUpConnection("http", "machine", 8600);
my $aUser = $csapi->Login("u00001", "u00001", "User", "\\\\machine\\ccmdb\\cm_database");
#Construct a new Globals object. my $globals = new ChangeSynergy::Globals(); #Export a CR report named 'My Report' from the shared preferences my $reportEntry = $csapi->exportAReport($aUser, "My Report", $globals->{PROBLEM_TYPE}, $globals->{SHARED_PROFILE}); my $queryEntry = $reportEntry->getQueryEntry();
print "Name: " . $queryEntry->getName() . "\n"; print "Query String: " . $queryEntry->getQueryString() . "\n"; print "Desc: " . $queryEntry->getDescription() . "\n"; print "Prompting: " . $queryEntry->getPromptingQueryXml() . "\n"; print "Template: " . $queryEntry->getTemplate() . "\n"; };
if ($@) { print $@; }
scalar |
getDescription() Gets the description for the query. |
scalar |
getName() Gets the name of the query, in the configuration example above this is the data in the NAME tag. |
scalar |
getPromptingQueryXml()> Gets the XML data that defines how a prompting query should function. |
scalar |
getQueryString() Gets the query string. |
scalar |
getTemplate() Gets the template file that will be loaded to prompt the user for query information. |
void |
setDescription(scalar description) Sets the description for this query, most likely this description will never been seen in the interface as the reports description will be shown to end users. |
void |
setName() Sets the name of the query, in the configuration example above this is the data in the NAME tag. In most cases the name of the query will not need to be modified as Change server will take care of uniquely naming the query as it is embedded in a report. |
void |
setPromptingQueryXml(scalar queryName) Sets the prompting query XML for the query. This defines how a prompting query should function. |
void |
setQueryString(scalar queryString) Sets the query string that will be used when the report is run. For example, (cvtype='problem') and (crstatus='assigned'). The query string is the one piece of data in a QueryEntry that you are most likely to Change while importing a report. |
void |
setTemplate() Sets the template file that will be loaded to prompt the user for query information when in the querying interface. |
Gets the description for the query. As a report has it's own description this description most likely will not be visible to any end users.
Returns: scalar The description of the query.
Gets the name of the query, since these queries are under a report the name of the query will never be displayed but a name must still exist.
Returns: scalar The name of the query.
Gets the prompting query XML data.
Returns: scalar The prompting query data in XML format.
Gets the query string for the query.
Returns: scalar A query string.
Gets the template file that will be loaded to prompt the user for query information. This only works for normal queries and not queries that are part of reports.
Returns: scalar The name of the template.
Sets the description for the query, As a report has it's own description this description most likely will not be visible to any end users.
Parameters: scalar: The description for the query.
Example: my $reportEntry = $csapi->exportAReport($aUser, "My Report", $globals->{PROBLEM_TYPE}, $globals->{SHARED_PROFILE}); my $queryEntry = $reportEntry->getQueryEntry(); $queryEntry->setDescription("All entered CRs");
Sets the name of the query, since these queries are under a report the name of the query will never be displayed but a name must still exist. The Change server will ensure that the name is unique.
Parameters: scalar: The name this query shall have upon creation.
Example: my $reportEntry = $csapi->exportAReport($aUser, "My Report", $globals->{PROBLEM_TYPE}, $globals->{SHARED_PROFILE}); my $queryEntry = $reportEntry->getQueryEntry(); $queryEntry->setName("All entered CRs");
Sets the prompting query XML data for the query. 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 $reportEntry = $csapi->exportAReport($aUser, "My Report", $globals->{PROBLEM_TYPE}, $globals->{SHARED_PROFILE}); my $queryEntry = $reportEntry->getQueryEntry(); $queryEntry->setPromptingQueryXml(XML DATA);
Sets the query string that will be used when the report is run.
Parameters: scalar: The query string.
Example: my $reportEntry = $csapi->exportAReport($aUser, "My Report", $globals->{PROBLEM_TYPE}, $globals->{SHARED_PROFILE}); my $queryEntry = $reportEntry->getQueryEntry(); $queryEntry->setQueryString("(cvtype='problem') and (crstatus='entered')");
Sets the template name that will be loaded to ask the user for query input. This only works for standard querise and not queries that are part of a report.
Parameters: scalar: The template name.
Example: my $reportEntry = $csapi->exportAReport($aUser, "My Report", $globals->{PROBLEM_TYPE}, $globals->{SHARED_PROFILE}); my $queryEntry = $reportEntry->getQueryEntry(); $queryEntry->setTemplate("NotEditableQuery");