Difference between revisions of "ExportManager class"
(Tag: visualeditor-switched) |
|||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{CGscriptClass_Template | {{CGscriptClass_Template | ||
− | |Name=ExportManager | + | |Name=<nowiki>ExportManager</nowiki> |
− | |Description=Export data and users. | + | |Description=<nowiki>Export data and users.</nowiki> |
− | |Constructors= | + | |InheritsFrom=object|Constructors= |
{{CGscriptConstructors_Template|Parameters= | {{CGscriptConstructors_Template|Parameters= | ||
− | {{CGscriptParameters_Template|Type=int|Name=ResourceId|Description=Resource Id of the Export}} | + | {{CGscriptParameters_Template|Type=int|Name=<nowiki>ResourceId</nowiki>|Description=<nowiki>Resource Id of the Export</nowiki>}} |
− | |Description=Instanciate an existing instance using the resource id of an export}} | + | |Description=<nowiki>Instanciate an existing instance using the resource id of an export</nowiki>}} |
{{CGscriptConstructors_Template|Parameters= | {{CGscriptConstructors_Template|Parameters= | ||
− | {{CGscriptParameters_Template|Type=string|Name=ResourceName|Description=Resource name of the new export|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=parentResourceId|Description=Parent to store the DCS export under}} | + | {{CGscriptParameters_Template|Type=string|Name=<nowiki>ResourceName</nowiki>|Description=<nowiki>Resource name of the new export</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=<nowiki>parentResourceId</nowiki>|Description=<nowiki>Parent to store the DCS export under</nowiki>}} |
− | |Description=Create a new export}} | + | |Description=<nowiki>Create a new export</nowiki>}} |
|Methods= | |Methods= | ||
− | {{CGscriptMethods_Template|ReturnType=bool|Name=AddQuestionnaire|Parameters= | + | {{CGscriptMethods_Template|ReturnType=bool|Name=<nowiki>AddQuestionnaire</nowiki>|Parameters= |
− | {{CGscriptParameters_Template|Type=int|Name=questionnaireResourceId|Description=Resource id of the questionnaire to export data from}} | + | {{CGscriptParameters_Template|Type=int|Name=<nowiki>questionnaireResourceId</nowiki>|Description=<nowiki>Resource id of the questionnaire to export data from</nowiki>}} |
− | |Description=Add questionnaire to export data from. Return false if already added}} | + | |Description=<nowiki>Add questionnaire to export data from. Return false if already added</nowiki>}} |
− | {{CGscriptMethods_Template|ReturnType=string|Name=Export|Description=Run the export. Implicitly commits the current transaction}} | + | {{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>Export</nowiki>|Description=<nowiki>Run the export. Implicitly commits the current transaction</nowiki>}} |
− | {{CGscriptMethods_Template|ReturnType=Empty|Name=Reset|Description=Remove all questionnaires from the export and clear all format settings}} | + | {{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>Reset</nowiki>|Description=<nowiki>Remove all questionnaires from the export and clear all format settings</nowiki>}} |
− | {{CGscriptMethods_Template|ReturnType=Empty|Name=Save|Description=Save the DataCache}} | + | {{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>Save</nowiki>|Description=<nowiki>Save the DataCache</nowiki>}} |
− | {{CGscriptMethods_Template|ReturnType=string|Name=ToString|Description=The string representation of the object.}} | + | {{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Inherited=object|Description=<nowiki>The string representation of the object.</nowiki>}} |
|Properties= | |Properties= | ||
− | {{CGscriptProperties_Template|ReturnType=DateTime|Name=CGEndTimeFrameUTC|HasGetter=1|HasSetter=1|Description=Get/set the maximum end time of QAS}} | + | {{CGscriptProperties_Template|ReturnType=DateTime|Name=<nowiki>CGEndTimeFrameUTC</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set the maximum end time of QAS</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=DateTime|Name=CGStartTimeFrameUTC|HasGetter=1|HasSetter=1|Description=Get/set the minimum end time of QAS}} | + | {{CGscriptProperties_Template|ReturnType=DateTime|Name=<nowiki>CGStartTimeFrameUTC</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set the minimum end time of QAS</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=ExportSettingsAsciiFile|Name=ExportSettingsAsciiFile|HasGetter=1|Description=Get settings for specific format}} | + | {{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>Culture</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set the language used when exporting text</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=ExportSettingsExcelCsvFile|Name=ExportSettingsExcelCsvFile|HasGetter=1|Description=Get settings for specific format}} | + | {{CGscriptProperties_Template|ReturnType=ExportSettingsAsciiFile|Name=<nowiki>ExportSettingsAsciiFile</nowiki>|HasGetter=1|Description=<nowiki>Get settings for specific format</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=ExportSettingsInspireFile|Name=ExportSettingsInspireSasTraceFile|HasGetter=1|Description=Get settings for specific format}} | + | {{CGscriptProperties_Template|ReturnType=ExportSettingsExcelCsvFile|Name=<nowiki>ExportSettingsExcelCsvFile</nowiki>|HasGetter=1|Description=<nowiki>Get settings for specific format</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=ExportSettingsNipoFile|Name=ExportSettingsNipoFile|HasGetter=1|Description=Get settings for specific format}} | + | {{CGscriptProperties_Template|ReturnType=ExportSettingsInspireFile|Name=<nowiki>ExportSettingsInspireSasTraceFile</nowiki>|HasGetter=1|Description=<nowiki>Get settings for specific format</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=ExportSettingsSpssFile|Name=ExportSettingsSpssFile|HasGetter=1|Description=Get settings for specific format}} | + | {{CGscriptProperties_Template|ReturnType=ExportSettingsNipoFile|Name=<nowiki>ExportSettingsNipoFile</nowiki>|HasGetter=1|Description=<nowiki>Get settings for specific format</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=ExportSettingsTripleSFile|Name=ExportSettingsTripleSFile|HasGetter=1|Description=Get settings for specific format}} | + | {{CGscriptProperties_Template|ReturnType=ExportSettingsSpssFile|Name=<nowiki>ExportSettingsSpssFile</nowiki>|HasGetter=1|Description=<nowiki>Get settings for specific format</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=bool|Name=IncludedDeletedUsers|HasGetter=1|HasSetter=1|Description=Get/set if include QAS on deleted users or not}} | + | {{CGscriptProperties_Template|ReturnType=ExportSettingsTripleSFile|Name=<nowiki>ExportSettingsTripleSFile</nowiki>|HasGetter=1|Description=<nowiki>Get settings for specific format</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=bool|Name=IncludedDisabledUsers|HasGetter=1|HasSetter=1|Description=Get/set if include QAS on disabled users or not}} | + | {{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>IncludedDeletedUsers</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set if include QAS on deleted users or not</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=bool|Name=IncludedTestData|HasGetter=1|HasSetter=1|Description=Get/set if include test QAS or not}} | + | {{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>IncludedDisabledUsers</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set if include QAS on disabled users or not</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=string|Name=Language|HasGetter=1|HasSetter=1|Description=Get/set the language used when exporting text}} | + | {{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>IncludedTestData</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set if include test QAS or not</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=int|Name=LimitToGroupResourceId|HasGetter=1|HasSetter=1|Description=Get/set the group that limits the people included in the export}} | + | {{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>Language</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set the language used when exporting text</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=string|Name=Name|HasGetter=1|HasSetter=1|Description=Get/set the name of the export}} | + | {{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>LimitToGroupResourceId</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set the group that limits the people included in the export</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=string|Name=ObjectTypeName|HasGetter=1|Description=The name of the type of object.}} | + | {{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>Name</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set the name of the export</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=bool|Name=QasCompleted|HasGetter=1|HasSetter=1|Description=Get/set if include Completed QAS or not}} | + | {{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>ObjectTypeName</nowiki>|HasGetter=1|Description=<nowiki>The name of the type of object.</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=bool|Name=QasInterviewFailed|HasGetter=1|HasSetter=1|Description=Get/set if include QAS with interview failed status or not}} | + | {{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>QasCompleted</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set if include Completed QAS or not</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=bool|Name=QasInterviewSucceded|HasGetter=1|HasSetter=1|Description=Get/set if include QAS with interview successed status or not}} | + | {{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>QasInterviewFailed</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set if include QAS with interview failed status or not</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=bool|Name=QasNormal|HasGetter=1|HasSetter=1|Description=Get/set if include QAS with normal status or not}} | + | {{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>QasInterviewSucceded</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set if include QAS with interview successed status or not</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=bool|Name=QasNotStarted|HasGetter=1|HasSetter=1|Description=Get/set if include unstarted QAS or not}} | + | {{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>QasNormal</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set if include QAS with normal status or not</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=bool|Name=QasOutsideTarget|HasGetter=1|HasSetter=1|Description=Get/set if include QAS with outside target status or not}} | + | {{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>QasNotStarted</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set if include unstarted QAS or not</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=bool|Name=QasPartly|HasGetter=1|HasSetter=1|Description=Get/set if include partly Completed QAS or not}} | + | {{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>QasOutsideTarget</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set if include QAS with outside target status or not</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=bool|Name=QasQuotaFull|HasGetter=1|HasSetter=1|Description=Get/set if include QAS with quota full status or not}} | + | {{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>QasPartly</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set if include partly Completed QAS or not</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=int|Name=ResourceId|HasGetter=1|Description=Get the resource id of the export}} | + | {{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>QasQuotaFull</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set if include QAS with quota full status or not</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=array|Name=SecondaryQasMergeAvailableMethods|HasGetter=1|Description=Get which methods are available for SecondaryQasMergeMethod}} | + | {{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>ResourceId</nowiki>|HasGetter=1|Description=<nowiki>Get the resource id of the export</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=string|Name=SecondaryQasMergeMethod|HasGetter=1|HasSetter=1|Description=Get/set which method to use to link together QAS from the secondary questionnaires to the primary, when there is more than 1}} | + | {{CGscriptProperties_Template|ReturnType=array|Name=<nowiki>SecondaryQasMergeAvailableMethods</nowiki>|HasGetter=1|Description=<nowiki>Get which methods are available for SecondaryQasMergeMethod</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=bool|Name=SelectTimeFrame|HasGetter=1|HasSetter=1|Description=Get/set if CGStartTimeFrameUTC and CGEndTimeFrameUTC are used or not}} | + | {{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>SecondaryQasMergeMethod</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set which method to use to link together QAS from the secondary questionnaires to the primary, when there is more than 1</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=TypeInformation|Name=TypeInformation|HasGetter=1|Description=Get information about this class.}} | + | {{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>SelectTimeFrame</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set if CGStartTimeFrameUTC and CGEndTimeFrameUTC are used or not</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=string|Name=UnicodeCodePage|HasGetter=1|HasSetter=1|Description=Get/set the codepage used in the files}} | + | {{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Inherited=object|Description=<nowiki>Get information about this class.</nowiki>}} |
+ | {{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>UnicodeCodePage</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set the codepage used in the files</nowiki>}} | ||
}} | }} | ||
Line 69: | Line 70: | ||
EM.Save(); | EM.Save(); | ||
//EM.Export(); | //EM.Export(); | ||
+ | </source> | ||
+ | |||
+ | <source lang="javascript"> | ||
+ | //create new export job | ||
+ | string ResourceName="Test - export"; | ||
+ | number qnaire = 15638322; | ||
+ | ExportManager EM= new ExportManager (ResourceName, qnaire ); | ||
+ | EM.AddQuestionnaire(qnaire); | ||
+ | ExportSettingsExcelCsvFile exportSetting = EM.ExportSettingsExcelCsvFile; | ||
+ | number questionnaireResourceId = qnaire; | ||
+ | bool presentAsText = false; | ||
+ | bool exportToCsv = false; | ||
+ | bool exportToExcel = true; | ||
+ | exportSetting.AddAllQuestions(questionnaireResourceId, presentAsText, exportToCsv, exportToExcel ); | ||
+ | exportSetting.ExcelFileOptionsUseCommaSeparatedFormat = true; | ||
+ | EM.Language ="da-DK"; | ||
+ | EM.Culture = "da-DK"; | ||
+ | exportSetting.ExportAddressInformation= false; | ||
+ | exportSetting.ExportPhoneNumbers = false; | ||
+ | exportSetting.ExportUserAccountInformation = true; | ||
+ | exportSetting.ExportUserEmail = true; | ||
+ | EM.QasNotStarted = false; | ||
+ | EM.QasPartly = false; | ||
+ | EM.QasCompleted = true; | ||
+ | EM.QasNormal = true; | ||
+ | EM.QasQuotaFull = false; | ||
+ | EM.QasOutsideTarget = false; | ||
+ | EM.QasInterviewFailed = false; | ||
+ | EM.QasInterviewSucceded = true; | ||
+ | EM.IncludedTestData= false; | ||
+ | EM.IncludedDeletedUsers = true; | ||
+ | EM.IncludedDisabledUsers = true; | ||
+ | EM.Save(); | ||
+ | EM.Export(); | ||
</source> | </source> |
Latest revision as of 06:00, 28 July 2022
ExportManager
Export data and users.
Parent class
Inherits from object
Constructors
- (int ResourceId "Resource Id of the Export") - Instanciate an existing instance using the resource id of an export
- (string ResourceName "Resource name of the new export", int parentResourceId "Parent to store the DCS export under") - Create a new export
Methods
- bool AddQuestionnaire(int questionnaireResourceId "Resource id of the questionnaire to export data from") - Add questionnaire to export data from. Return false if already added
- string Export() - Run the export. Implicitly commits the current transaction
- Empty Reset() - Remove all questionnaires from the export and clear all format settings
- Empty Save() - Save the DataCache
- (From object) string ToString() - The string representation of the object.
Properties
- DateTime CGEndTimeFrameUTC { get; set; } - Get/set the maximum end time of QAS
- DateTime CGStartTimeFrameUTC { get; set; } - Get/set the minimum end time of QAS
- string Culture { get; set; } - Get/set the language used when exporting text
- ExportSettingsAsciiFile ExportSettingsAsciiFile { get; } - Get settings for specific format
- ExportSettingsExcelCsvFile ExportSettingsExcelCsvFile { get; } - Get settings for specific format
- ExportSettingsInspireFile ExportSettingsInspireSasTraceFile { get; } - Get settings for specific format
- ExportSettingsNipoFile ExportSettingsNipoFile { get; } - Get settings for specific format
- ExportSettingsSpssFile ExportSettingsSpssFile { get; } - Get settings for specific format
- ExportSettingsTripleSFile ExportSettingsTripleSFile { get; } - Get settings for specific format
- bool IncludedDeletedUsers { get; set; } - Get/set if include QAS on deleted users or not
- bool IncludedDisabledUsers { get; set; } - Get/set if include QAS on disabled users or not
- bool IncludedTestData { get; set; } - Get/set if include test QAS or not
- string Language { get; set; } - Get/set the language used when exporting text
- int LimitToGroupResourceId { get; set; } - Get/set the group that limits the people included in the export
- string Name { get; set; } - Get/set the name of the export
- string ObjectTypeName { get; } - The name of the type of object.
- bool QasCompleted { get; set; } - Get/set if include Completed QAS or not
- bool QasInterviewFailed { get; set; } - Get/set if include QAS with interview failed status or not
- bool QasInterviewSucceded { get; set; } - Get/set if include QAS with interview successed status or not
- bool QasNormal { get; set; } - Get/set if include QAS with normal status or not
- bool QasNotStarted { get; set; } - Get/set if include unstarted QAS or not
- bool QasOutsideTarget { get; set; } - Get/set if include QAS with outside target status or not
- bool QasPartly { get; set; } - Get/set if include partly Completed QAS or not
- bool QasQuotaFull { get; set; } - Get/set if include QAS with quota full status or not
- int ResourceId { get; } - Get the resource id of the export
- array SecondaryQasMergeAvailableMethods { get; } - Get which methods are available for SecondaryQasMergeMethod
- string SecondaryQasMergeMethod { get; set; } - Get/set which method to use to link together QAS from the secondary questionnaires to the primary, when there is more than 1
- bool SelectTimeFrame { get; set; } - Get/set if CGStartTimeFrameUTC and CGEndTimeFrameUTC are used or not
- (From object) TypeInformation TypeInformation { get; } - Get information about this class.
- string UnicodeCodePage { get; set; } - Get/set the codepage used in the files
Examples
//get an existing export
number ExportRId = ;
ExportManager EM = new ExportManager(ExportRId);
ExportSettingsExcelCsvFile exportSetting = EM.ExportSettingsExcelCsvFile;
exportSetting.Clear();
number questionnaireResourceId = ;
string questionLabel = "";
bool presentAsText = false;
bool exportToCsv = true;
bool exportToExcel = false;
exportSetting.AddQuestion(questionnaireResourceId, questionLabel, presentAsText, exportToCsv, exportToExcel );
exportSetting.ExcelFileOptionsUseCommaSeparatedFormat = true;
exportSetting.ExportAddressInformation= false;
exportSetting.ExportPhoneNumbers = false;
exportSetting.ExportUserAccountInformation = false;
exportSetting.ExportUserEmail = false;
EM.Save();
//EM.Export();
//create new export job
string ResourceName="Test - export";
number qnaire = 15638322;
ExportManager EM= new ExportManager (ResourceName, qnaire );
EM.AddQuestionnaire(qnaire);
ExportSettingsExcelCsvFile exportSetting = EM.ExportSettingsExcelCsvFile;
number questionnaireResourceId = qnaire;
bool presentAsText = false;
bool exportToCsv = false;
bool exportToExcel = true;
exportSetting.AddAllQuestions(questionnaireResourceId, presentAsText, exportToCsv, exportToExcel );
exportSetting.ExcelFileOptionsUseCommaSeparatedFormat = true;
EM.Language ="da-DK";
EM.Culture = "da-DK";
exportSetting.ExportAddressInformation= false;
exportSetting.ExportPhoneNumbers = false;
exportSetting.ExportUserAccountInformation = true;
exportSetting.ExportUserEmail = true;
EM.QasNotStarted = false;
EM.QasPartly = false;
EM.QasCompleted = true;
EM.QasNormal = true;
EM.QasQuotaFull = false;
EM.QasOutsideTarget = false;
EM.QasInterviewFailed = false;
EM.QasInterviewSucceded = true;
EM.IncludedTestData= false;
EM.IncludedDeletedUsers = true;
EM.IncludedDisabledUsers = true;
EM.Save();
EM.Export();