Tabulation saveAsReport
[Will obsolete soon and replace by Tabulation.SaveAsReport. More detail at ConversionMethods ]
Tabulation_saveAsReport
This function tells the interpreter to save the tabulation results as a report once the script is executed, and returns the report's resource unique id.
The report created will be a standard report and diagrams based on dynamic custom columns must be included as diagrams with fixed values, because the custom columns will not be available if the user chooses to view the report later.
If overwrite is set to true and if a report and / or report template already exists under the parent resource specified then they will be deleted given that the current user has sufficient permission to do so, else a runtime exception must be thrown.
By default the current user will get full permission to both the report and report template.
Syntax
Tabulation_saveAsReport(name, parentResourceId, permissionGroups [, overwrite])
Arguments
name: Is a string expression. This is the name which will be used for both the report and the report template. The name must conform to the business rules specified for resource names, failing to do so must result in a runtime exception.
parentResourceId: Is a number expression. This is the id for the parent resource which will contain the report and report template (having a path on a report template will be possible from version 5.5). The following resources can be used as parent: Folder and Project. Using any other parent as resource will result in a runtime exception. The current user (user context) must have sufficient permission for the parent resource in order to add the report and report template, failing to have sufficient permissions must result in a runtime exception being thrown.
permissionGroups: Is an array consisting of arrays of 2 elements. First element must be a group id and the second element a permission level. This way it is possible to give different groups different levels of resource access. If the format of the permissionGroups argument is not according to the above then a runtime exception must be thrown.
overwrite: If set to true the existing report and report template will be overwritten. The argument is optional and if not specified overwrite must default to false causing a runtime exception if the report and report template already exists.
Return type
Number (ResourceId of the newly generated Report)
Examples
createCrossDiagram({"Sex"}, {"Civil_status"});
array groups = {{1, "Read"}, {2, "Write"}};
number reportUniqueId = Tabulation_saveAsReport("Tabulation report", 123, groups, true);
//Result: Return Resource Id of the newly generated Report (e.g: 37282468)
Availability
Version 5.5