Difference between revisions of "ExportManager class"
Line 2: | Line 2: | ||
|Name=<nowiki>ExportManager</nowiki> | |Name=<nowiki>ExportManager</nowiki> | ||
|Description=<nowiki>Export data and users.</nowiki> | |Description=<nowiki>Export data and users.</nowiki> | ||
− | |Constructors= | + | |InheritsFrom=object|Constructors= |
{{CGscriptConstructors_Template|Parameters= | {{CGscriptConstructors_Template|Parameters= | ||
{{CGscriptParameters_Template|Type=int|Name=<nowiki>ResourceId</nowiki>|Description=<nowiki>Resource Id of the Export</nowiki>}} | {{CGscriptParameters_Template|Type=int|Name=<nowiki>ResourceId</nowiki>|Description=<nowiki>Resource Id of the Export</nowiki>}} | ||
Line 16: | Line 16: | ||
{{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=<nowiki>Reset</nowiki>|Description=<nowiki>Remove all questionnaires from the export and clear all format settings</nowiki>}} | ||
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>Save</nowiki>|Description=<nowiki>Save the DataCache</nowiki>}} | {{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>Save</nowiki>|Description=<nowiki>Save the DataCache</nowiki>}} | ||
− | {{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Description=<nowiki>The string representation of the object.</nowiki>}} | + | {{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=<nowiki>CGEndTimeFrameUTC</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set the maximum end time of QAS</nowiki>}} | {{CGscriptProperties_Template|ReturnType=DateTime|Name=<nowiki>CGEndTimeFrameUTC</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set the maximum end time of QAS</nowiki>}} | ||
Line 46: | Line 46: | ||
{{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=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=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=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=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Description=<nowiki>Get information about this class.</nowiki>}} | + | {{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>}} | {{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>UnicodeCodePage</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set the codepage used in the files</nowiki>}} | ||
}} | }} | ||
− | |||
=== <span style="color:#DF8621">'''Examples'''</span> === | === <span style="color:#DF8621">'''Examples'''</span> === |
Revision as of 08:03, 2 July 2020
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
number 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();