Difference between revisions of "QAS class"

From Catglobe Wiki
Jump to: navigation, search
 
(11 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
|Name=<nowiki>QAS</nowiki>
 
|Name=<nowiki>QAS</nowiki>
 
|Description=<nowiki>Questionnaire answer sheet.</nowiki>
 
|Description=<nowiki>Questionnaire answer sheet.</nowiki>
|Constructors=
+
|InheritsFrom=Array|Constructors=
 
{{CGscriptConstructors_Template|Parameters=
 
{{CGscriptConstructors_Template|Parameters=
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>qasId</nowiki>|Description=<nowiki>Id of the questionnaire</nowiki>}}
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>qasId</nowiki>|Description=<nowiki>Id of the questionnaire</nowiki>}}
Line 11: Line 11:
 
{{CGscriptConstructors_Template|Parameters=
 
{{CGscriptConstructors_Template|Parameters=
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>QuestionnaireResourceId</nowiki>|Description=<nowiki>Questionnaire resource id</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=<nowiki>UserResourceId</nowiki>|Description=<nowiki>User resource id. 0 to use current.</nowiki>}}
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>QuestionnaireResourceId</nowiki>|Description=<nowiki>Questionnaire resource id</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=<nowiki>UserResourceId</nowiki>|Description=<nowiki>User resource id. 0 to use current.</nowiki>}}
 +
|Description=<nowiki>Create new qas.</nowiki>}}
 +
{{CGscriptConstructors_Template|Parameters=
 +
{{CGscriptParameters_Template|Type=int|Name=<nowiki>QuestionnaireResourceId</nowiki>|Description=<nowiki>Questionnaire resource id</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=<nowiki>UserResourceId</nowiki>|Description=<nowiki>User resource id. 0 to use current.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=bool|Name=<nowiki>setTest</nowiki>|Description=<nowiki>Set QAS to test.</nowiki>}}
 
|Description=<nowiki>Create new qas.</nowiki>}}
 
|Description=<nowiki>Create new qas.</nowiki>}}
 
|Methods=
 
|Methods=
{{CGscriptMethods_Template|ReturnType=bool|Name=<nowiki>Any</nowiki>|Parameters=
+
{{CGscriptMethods_Template|ReturnType=bool|Name=<nowiki>Any</nowiki>|Inherited=array|Parameters=
 
{{CGscriptParameters_Template|Type=Function|Name=<nowiki>predicate</nowiki>|Description=<nowiki>A function that takes 1 parameter of the types in the array, and return true/false</nowiki>}}
 
{{CGscriptParameters_Template|Type=Function|Name=<nowiki>predicate</nowiki>|Description=<nowiki>A function that takes 1 parameter of the types in the array, and return true/false</nowiki>}}
 
|Description=<nowiki>Return true if the array contains the element using the given function.</nowiki>}}
 
|Description=<nowiki>Return true if the array contains the element using the given function.</nowiki>}}
{{CGscriptMethods_Template|ReturnType=bool|Name=<nowiki>Contains</nowiki>|Parameters=
+
{{CGscriptMethods_Template|ReturnType=bool|Name=<nowiki>Contains</nowiki>|Inherited=array|Parameters=
 
{{CGscriptParameters_Template|Type=object|Name=<nowiki>element</nowiki>|Description=<nowiki>Element to check for</nowiki>}}
 
{{CGscriptParameters_Template|Type=object|Name=<nowiki>element</nowiki>|Description=<nowiki>Element to check for</nowiki>}}
 
|Description=<nowiki>Return true if the array contains the element using the normal equal operator.</nowiki>}}
 
|Description=<nowiki>Return true if the array contains the element using the normal equal operator.</nowiki>}}
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>Except</nowiki>|Parameters=
+
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>Except</nowiki>|Inherited=array|Parameters=
 
{{CGscriptParameters_Template|Type=array|Name=<nowiki>elements</nowiki>|Description=<nowiki>Elements to remove</nowiki>}}
 
{{CGscriptParameters_Template|Type=array|Name=<nowiki>elements</nowiki>|Description=<nowiki>Elements to remove</nowiki>}}
 
|Description=<nowiki>Return all elements that does not exist in the other collection.</nowiki>}}
 
|Description=<nowiki>Return all elements that does not exist in the other collection.</nowiki>}}
{{CGscriptMethods_Template|ReturnType=object|Name=<nowiki>First</nowiki>|Parameters=
+
{{CGscriptMethods_Template|ReturnType=object|Name=<nowiki>First</nowiki>|Inherited=array|Parameters=
 
{{CGscriptParameters_Template|Type=Function|Name=<nowiki>selector</nowiki>|Description=<nowiki>A function to test each element for a condition.</nowiki>}}
 
{{CGscriptParameters_Template|Type=Function|Name=<nowiki>selector</nowiki>|Description=<nowiki>A function to test each element for a condition.</nowiki>}}
 
|Description=<nowiki>Returns the first element in a sequence that satisfies a specified condition.</nowiki>}}
 
|Description=<nowiki>Returns the first element in a sequence that satisfies a specified condition.</nowiki>}}
{{CGscriptMethods_Template|ReturnType=object|Name=<nowiki>FirstOrDefault</nowiki>|Parameters=
+
{{CGscriptMethods_Template|ReturnType=object|Name=<nowiki>FirstOrDefault</nowiki>|Inherited=array|Parameters=
 
{{CGscriptParameters_Template|Type=Function|Name=<nowiki>selector</nowiki>|Description=<nowiki>A function to test each element for a condition.</nowiki>}}
 
{{CGscriptParameters_Template|Type=Function|Name=<nowiki>selector</nowiki>|Description=<nowiki>A function to test each element for a condition.</nowiki>}}
 
|Description=<nowiki>Returns the first element in a sequence that satisfies a specified condition or empty if not found.</nowiki>}}
 
|Description=<nowiki>Returns the first element in a sequence that satisfies a specified condition or empty if not found.</nowiki>}}
{{CGscriptMethods_Template|ReturnType=int|Name=<nowiki>Frequency</nowiki>|Parameters=
+
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>Foreach</nowiki>|Inherited=array|Parameters=
 +
{{CGscriptParameters_Template|Type=Function|Name=<nowiki>function</nowiki>|Description=<nowiki>A function that takes 1 parameter of the types in the array, and an optional 2nd parameter that is the index</nowiki>}}
 +
|Description=<nowiki>Filters a sequence of values based on a predicate.</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=int|Name=<nowiki>Frequency</nowiki>|Inherited=array|Parameters=
 
{{CGscriptParameters_Template|Type=number|Name=<nowiki>number</nowiki>|Description=<nowiki>The number to search for</nowiki>}}
 
{{CGscriptParameters_Template|Type=number|Name=<nowiki>number</nowiki>|Description=<nowiki>The number to search for</nowiki>}}
 
|Description=<nowiki>Counts the number of times a given Number object exists in the Array. Can only use if all the elements are of type Number</nowiki>}}
 
|Description=<nowiki>Counts the number of times a given Number object exists in the Array. Can only use if all the elements are of type Number</nowiki>}}
Line 34: Line 40:
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>index</nowiki>|Description=<nowiki>Index</nowiki>}}
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>index</nowiki>|Description=<nowiki>Index</nowiki>}}
 
|Description=<nowiki>Backward-compatible indexer</nowiki>}}
 
|Description=<nowiki>Backward-compatible indexer</nowiki>}}
{{CGscriptMethods_Template|ReturnType=int|Name=<nowiki>IndexOf</nowiki>|Parameters=
+
{{CGscriptMethods_Template|ReturnType=QAS|Name=<nowiki>GetCaller</nowiki>|Description=<nowiki>Return the QAS that used GotoQuestionnaire to jump to this QAS. Empty if nothing on callstack</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>GotoQuestionnaire</nowiki>|Description=<nowiki>Jump to this qas. This function never returns</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=int|Name=<nowiki>IndexOf</nowiki>|Inherited=array|Parameters=
 
{{CGscriptParameters_Template|Type=object|Name=<nowiki>element</nowiki>|Description=<nowiki>Element to search for</nowiki>}}
 
{{CGscriptParameters_Template|Type=object|Name=<nowiki>element</nowiki>|Description=<nowiki>Element to search for</nowiki>}}
 
|Description=<nowiki>Return index of the given element, or -1.</nowiki>}}
 
|Description=<nowiki>Return index of the given element, or -1.</nowiki>}}
{{CGscriptMethods_Template|ReturnType=bool|Name=<nowiki>IsCharacterArray</nowiki>|Description=<nowiki>check if array is an array of characters</nowiki>}}
+
{{CGscriptMethods_Template|ReturnType=bool|Name=<nowiki>IsCharacterArray</nowiki>|Inherited=array|Description=<nowiki>check if array is an array of characters</nowiki>}}
{{CGscriptMethods_Template|ReturnType=bool|Name=<nowiki>IsNumericArray</nowiki>|Description=<nowiki>check if array is an array of integer numbers</nowiki>}}
+
{{CGscriptMethods_Template|ReturnType=bool|Name=<nowiki>IsNumericArray</nowiki>|Inherited=array|Description=<nowiki>check if array is an array of integer numbers</nowiki>}}
{{CGscriptMethods_Template|ReturnType=bool|Name=<nowiki>IsStringArray</nowiki>|Description=<nowiki>check if array is an array of string</nowiki>}}
+
{{CGscriptMethods_Template|ReturnType=bool|Name=<nowiki>IsStringArray</nowiki>|Inherited=array|Description=<nowiki>check if array is an array of string</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>MakeCurrentQAS</nowiki>|Description=<nowiki>Set as the current context qas.</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>MakeCurrentQAS</nowiki>|Description=<nowiki>Set as the current context qas.</nowiki>}}
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>OrderBy</nowiki>|Parameters=
+
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>OrderBy</nowiki>|Inherited=array|Parameters=
 
{{CGscriptParameters_Template|Type=Function|Name=<nowiki>comparer</nowiki>|Description=<nowiki>Function that compares two objects of the same type. Must return a signed integer that indicates the relative values of first param A and second param B. Value Less than 0 : A is less than B.Value 0 : A equals B.Value Greater than 0 : A is greater than B.It can also be a function that takes 1 parameter and returns a string or number.</nowiki>}}
 
{{CGscriptParameters_Template|Type=Function|Name=<nowiki>comparer</nowiki>|Description=<nowiki>Function that compares two objects of the same type. Must return a signed integer that indicates the relative values of first param A and second param B. Value Less than 0 : A is less than B.Value 0 : A equals B.Value Greater than 0 : A is greater than B.It can also be a function that takes 1 parameter and returns a string or number.</nowiki>}}
 
|Description=<nowiki>Sorts the elements of a sequence in ascending order by using a specified comparer.</nowiki>}}
 
|Description=<nowiki>Sorts the elements of a sequence in ascending order by using a specified comparer.</nowiki>}}
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>Randomize</nowiki>|Description=<nowiki>Randomize the order of the elements in the current array.</nowiki>}}
+
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>Randomize</nowiki>|Inherited=array|Description=<nowiki>Randomize the order of the elements in the current array.</nowiki>}}
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>Reverse</nowiki>|Description=<nowiki>Returns an array with all the elements in the opposite order.</nowiki>}}
+
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>Reset</nowiki>|Description=<nowiki>Reset progress in current QAS without delete data.</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>Reverse</nowiki>|Inherited=array|Description=<nowiki>Returns an array with all the elements in the opposite order.</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>Save</nowiki>|Description=<nowiki>Save qas.</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>Save</nowiki>|Description=<nowiki>Save qas.</nowiki>}}
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>Select</nowiki>|Parameters=
+
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>Select</nowiki>|Inherited=array|Parameters=
 
{{CGscriptParameters_Template|Type=Function|Name=<nowiki>selector</nowiki>|Description=<nowiki>A transform function to apply to each element.</nowiki>}}
 
{{CGscriptParameters_Template|Type=Function|Name=<nowiki>selector</nowiki>|Description=<nowiki>A transform function to apply to each element.</nowiki>}}
 
|Description=<nowiki>Projects each element of a sequence into a new form.</nowiki>}}
 
|Description=<nowiki>Projects each element of a sequence into a new form.</nowiki>}}
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>SelectMany</nowiki>|Parameters=
+
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>SelectMany</nowiki>|Inherited=array|Parameters=
 
{{CGscriptParameters_Template|Type=Function|Name=<nowiki>selector</nowiki>|Description=<nowiki>A transform function to get each sub array.</nowiki>}}
 
{{CGscriptParameters_Template|Type=Function|Name=<nowiki>selector</nowiki>|Description=<nowiki>A transform function to get each sub array.</nowiki>}}
 
|Description=<nowiki>Projects each array element of a sequence into a new form.</nowiki>}}
 
|Description=<nowiki>Projects each array element of a sequence into a new form.</nowiki>}}
Line 56: Line 65:
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>index</nowiki>|Description=<nowiki>Index</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=object|Name=<nowiki>value</nowiki>|Description=<nowiki>Value to set</nowiki>}}
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>index</nowiki>|Description=<nowiki>Index</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=object|Name=<nowiki>value</nowiki>|Description=<nowiki>Value to set</nowiki>}}
 
|Description=<nowiki>Backward-compatible indexer</nowiki>}}
 
|Description=<nowiki>Backward-compatible indexer</nowiki>}}
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>Skip</nowiki>|Parameters=
+
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>Skip</nowiki>|Inherited=array|Parameters=
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>n</nowiki>|Description=<nowiki>How many elements to skip</nowiki>}}
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>n</nowiki>|Description=<nowiki>How many elements to skip</nowiki>}}
 
|Description=<nowiki>Get all but the n first elements.</nowiki>}}
 
|Description=<nowiki>Get all but the n first elements.</nowiki>}}
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>Take</nowiki>|Parameters=
+
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>Take</nowiki>|Inherited=array|Parameters=
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>n</nowiki>|Description=<nowiki>How many elements to take</nowiki>}}
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>n</nowiki>|Description=<nowiki>How many elements to take</nowiki>}}
 
|Description=<nowiki>Get the n first elements.</nowiki>}}
 
|Description=<nowiki>Get the n first elements.</nowiki>}}
{{CGscriptMethods_Template|ReturnType=Dictionary|Name=<nowiki>ToDictionary</nowiki>|Parameters=
+
{{CGscriptMethods_Template|ReturnType=Dictionary|Name=<nowiki>ToDictionary</nowiki>|Inherited=array|Parameters=
 
{{CGscriptParameters_Template|Type=Function|Name=<nowiki>keySelector</nowiki>|Description=<nowiki>A transform function to get the key of each element.</nowiki>}}
 
{{CGscriptParameters_Template|Type=Function|Name=<nowiki>keySelector</nowiki>|Description=<nowiki>A transform function to get the key of each element.</nowiki>}}
 
|Description=<nowiki>Return a dictionary with the elements of the array.</nowiki>}}
 
|Description=<nowiki>Return a dictionary with the elements of the array.</nowiki>}}
{{CGscriptMethods_Template|ReturnType=Dictionary|Name=<nowiki>ToDictionary</nowiki>|Parameters=
+
{{CGscriptMethods_Template|ReturnType=Dictionary|Name=<nowiki>ToDictionary</nowiki>|Inherited=array|Parameters=
 
{{CGscriptParameters_Template|Type=Function|Name=<nowiki>keySelector</nowiki>|Description=<nowiki>A transform function to get the key of each element.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=Function|Name=<nowiki>valueSelector</nowiki>|Description=<nowiki>A transform function to get the value of each element.</nowiki>}}
 
{{CGscriptParameters_Template|Type=Function|Name=<nowiki>keySelector</nowiki>|Description=<nowiki>A transform function to get the key of each element.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=Function|Name=<nowiki>valueSelector</nowiki>|Description=<nowiki>A transform function to get the value of each element.</nowiki>}}
 
|Description=<nowiki>Return a dictionary with the elements of the array.</nowiki>}}
 
|Description=<nowiki>Return a dictionary with the elements of the array.</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=Array|Description=<nowiki>The string representation of the object.</nowiki>}}
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>Where</nowiki>|Parameters=
+
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>Where</nowiki>|Inherited=array|Parameters=
{{CGscriptParameters_Template|Type=Function|Name=<nowiki>predicate</nowiki>|Description=<nowiki>A function that takes 1 parameter of the types in the array and return true/false</nowiki>}}
+
{{CGscriptParameters_Template|Type=Function|Name=<nowiki>predicate</nowiki>|Description=<nowiki>A function that takes 1 parameter of the types in the array, and an optional 2nd parameter that is the index and return true/false</nowiki>}}
 
|Description=<nowiki>Filters a sequence of values based on a predicate.</nowiki>}}
 
|Description=<nowiki>Filters a sequence of values based on a predicate.</nowiki>}}
 
|Properties=
 
|Properties=
 
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>AccessCode</nowiki>|HasGetter=1|Description=<nowiki>Get the unique access code for use in login or sms-style url.</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>AccessCode</nowiki>|HasGetter=1|Description=<nowiki>Get the unique access code for use in login or sms-style url.</nowiki>}}
{{CGscriptProperties_Template|ReturnType=number|Name=<nowiki>Average</nowiki>|HasGetter=1|Description=<nowiki>Average of the objects in the Array object. Can only use if all the elements are of type Number</nowiki>}}
+
{{CGscriptProperties_Template|ReturnType=number|Name=<nowiki>Average</nowiki>|HasGetter=1|Inherited=array|Description=<nowiki>Average of the objects in the Array object. Can only use if all the elements are of type Number</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=DateTime|Name=<nowiki>CatiAppointment</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>When should Cati attempt to call this Qas, assuming they are on appointment or retry list.</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=DateTime|Name=<nowiki>CatiAppointment</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>When should Cati attempt to call this Qas, assuming they are on appointment or retry list.</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=DateTime|Name=<nowiki>CatiCallTime</nowiki>|HasGetter=1|Description=<nowiki>If meeting or retry, when will this qas be schedule for.</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=DateTime|Name=<nowiki>CatiCallTime</nowiki>|HasGetter=1|Description=<nowiki>If meeting or retry, when will this qas be schedule for.</nowiki>}}
Line 83: Line 92:
 
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>Deleted</nowiki>|HasGetter=1|Description=<nowiki>Get if marked deleted.</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>Deleted</nowiki>|HasGetter=1|Description=<nowiki>Get if marked deleted.</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=DateTime|Name=<nowiki>EndDate</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>When was this qas finished.</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=DateTime|Name=<nowiki>EndDate</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>When was this qas finished.</nowiki>}}
 +
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>Guid</nowiki>|HasGetter=1|Description=<nowiki>Id of the QAS in GUID format</nowiki>}}
 +
{{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>Id</nowiki>|HasGetter=1|Description=<nowiki>Id of the QAS</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>IsInSyncWithQuestionnaire</nowiki>|HasGetter=1|Description=<nowiki>Return true if the version the Qas was last active on is also the current questionnaire version.</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>IsInSyncWithQuestionnaire</nowiki>|HasGetter=1|Description=<nowiki>Return true if the version the Qas was last active on is also the current questionnaire version.</nowiki>}}
{{CGscriptProperties_Template|ReturnType=number|Name=<nowiki>Max</nowiki>|HasGetter=1|Description=<nowiki>Largest of all the objects in the Array object. Can only use if all the elements are of type Number</nowiki>}}
+
{{CGscriptProperties_Template|ReturnType=number|Name=<nowiki>Max</nowiki>|HasGetter=1|Inherited=array|Description=<nowiki>Largest of all the objects in the Array object. Can only use if all the elements are of type Number</nowiki>}}
{{CGscriptProperties_Template|ReturnType=number|Name=<nowiki>Min</nowiki>|HasGetter=1|Description=<nowiki>Smallest of all the objects in the Array object. Can only use if all the elements are of type Number</nowiki>}}
+
{{CGscriptProperties_Template|ReturnType=number|Name=<nowiki>Min</nowiki>|HasGetter=1|Inherited=array|Description=<nowiki>Smallest of all the objects in the Array object. Can only use if all the elements are of type Number</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>ObjectTypeName</nowiki>|HasGetter=1|Description=<nowiki>The name of the type of object.</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>ObjectTypeName</nowiki>|HasGetter=1|Description=<nowiki>The name of the type of object.</nowiki>}}
 +
{{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>QuestionnaireResourceId</nowiki>|HasGetter=1|Description=<nowiki>Resource Id of the questionnaire.</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=Array of strings|Name=<nowiki>QuestionSequence</nowiki>|HasGetter=1|Description=<nowiki>Get the expected sequence of questions to be viewed following the question group rules etc, but not any CgScript or Conditions, only accurate if IsInSyncWithQuestionnaire is true</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=Array of strings|Name=<nowiki>QuestionSequence</nowiki>|HasGetter=1|Description=<nowiki>Get the expected sequence of questions to be viewed following the question group rules etc, but not any CgScript or Conditions, only accurate if IsInSyncWithQuestionnaire is true</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>QuestionSequenceIndex</nowiki>|HasGetter=1|Description=<nowiki>Get the index into QuestionSequence of what is current question, only accurate if IsInSyncWithQuestionnaire is true</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>QuestionSequenceIndex</nowiki>|HasGetter=1|Description=<nowiki>Get the index into QuestionSequence of what is current question, only accurate if IsInSyncWithQuestionnaire is true</nowiki>}}
Line 92: Line 104:
 
{{CGscriptProperties_Template|ReturnType=DateTime|Name=<nowiki>StartDate</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>When was this qas started.</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=DateTime|Name=<nowiki>StartDate</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>When was this qas started.</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>Status</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Current status of qas. See UserProjectQuestionnaire_Status_xxx/RPQ_Status_xxx.</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>Status</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Current status of qas. See UserProjectQuestionnaire_Status_xxx/RPQ_Status_xxx.</nowiki>}}
{{CGscriptProperties_Template|ReturnType=number|Name=<nowiki>Sum</nowiki>|HasGetter=1|Description=<nowiki>Sum of all the objects in the Array object. Can only use if all the elements are of type Number</nowiki>}}
+
{{CGscriptProperties_Template|ReturnType=number|Name=<nowiki>Sum</nowiki>|HasGetter=1|Inherited=array|Description=<nowiki>Sum of all the objects in the Array object. Can only use if all the elements are of type Number</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>Test</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set if test qas.</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>Test</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set if test qas.</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=int|Name=<nowiki>UserId</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set user the qas belongs to. May be 0 for anonymous</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>UserId</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set user the qas belongs to. May be 0 for anonymous</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>UserResourceId</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set user the qas belongs to. May be 0 for anonymous</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>UserResourceId</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set user the qas belongs to. May be 0 for anonymous</nowiki>}}
{{CGscriptProperties_Template|ReturnType=Array of numbers|Name=<nowiki>ViewedQuestions</nowiki>|HasGetter=1|Description=<nowiki>Get the questions the viewed as index into QuestionSequence, only accurate if IsInSyncWithQuestionnaire is true</nowiki>}}
+
{{CGscriptProperties_Template|ReturnType=Array of ints|Name=<nowiki>ViewedQuestions</nowiki>|HasGetter=1|Description=<nowiki>Get the questions the viewed as index into QuestionSequence, only accurate if IsInSyncWithQuestionnaire is true</nowiki>}}
 
|StaticMethods=
 
|StaticMethods=
{{CGscriptMethods_Template|ReturnType=Array of numbers|Name=<nowiki>QAS_anonymize</nowiki>|Parameters=
+
{{CGscriptMethods_Template|ReturnType=Array of ints|Name=<nowiki>QAS_anonymize</nowiki>|Parameters=
{{CGscriptParameters_Template|Type=Unknown|Name=<nowiki>qasIds</nowiki>|Description=<nowiki>List of qas ids</nowiki>}}
+
{{CGscriptParameters_Template|Type=Array of ints|Name=<nowiki>qasIds</nowiki>|Description=<nowiki>List of qas ids</nowiki>}}
 
|Description=<nowiki>Delete all user references for the qas and data. Returns list of qas that qas NOT anonymized.</nowiki>}}
 
|Description=<nowiki>Delete all user references for the qas and data. Returns list of qas that qas NOT anonymized.</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>QAS_createUniqueAccessCode</nowiki>|Parameters=
 
{{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>QAS_createUniqueAccessCode</nowiki>|Parameters=
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>qasId</nowiki>|Description=<nowiki>Id of the questionnaire</nowiki>}}
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>qasId</nowiki>|Description=<nowiki>Id of the questionnaire</nowiki>}}
 
|Description=<nowiki>Return the unique access code for this qas.</nowiki>}}
 
|Description=<nowiki>Return the unique access code for this qas.</nowiki>}}
{{CGscriptMethods_Template|ReturnType=Array of numbers|Name=<nowiki>QAS_deleteData</nowiki>|Parameters=
+
{{CGscriptMethods_Template|ReturnType=Array of ints|Name=<nowiki>QAS_deleteData</nowiki>|Parameters=
{{CGscriptParameters_Template|Type=Unknown|Name=<nowiki>qasIds</nowiki>|Description=<nowiki>List of qas ids</nowiki>}}
+
{{CGscriptParameters_Template|Type=Array of ints|Name=<nowiki>qasIds</nowiki>|Description=<nowiki>List of qas ids</nowiki>}}
 
|Description=<nowiki>Delete data for the given qas. Returns list of qas that qas NOT deleted data for.</nowiki>}}
 
|Description=<nowiki>Delete data for the given qas. Returns list of qas that qas NOT deleted data for.</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=bool|Name=<nowiki>QAS_exists</nowiki>|Parameters=
 
{{CGscriptMethods_Template|ReturnType=bool|Name=<nowiki>QAS_exists</nowiki>|Parameters=
Line 125: Line 137:
 
|Description=<nowiki>Find qas by the access code.</nowiki>}}
 
|Description=<nowiki>Find qas by the access code.</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=Array of QAS|Name=<nowiki>QAS_getByUserResourceId</nowiki>|Parameters=
 
{{CGscriptMethods_Template|ReturnType=Array of QAS|Name=<nowiki>QAS_getByUserResourceId</nowiki>|Parameters=
{{CGscriptParameters_Template|Type=int|Name=<nowiki>userResourceId</nowiki>|Description=<nowiki>User resource id.</nowiki>}}
+
{{CGscriptParameters_Template|Type=int|Name=<nowiki>userResourceId</nowiki>|Description=<nowiki>User resource id. 0 to use current.</nowiki>}}
|Description=<nowiki>Get a list of qas by the specified user for all questionnaires.</nowiki>}}
+
|Description=<nowiki>Get a list of qas by the specified user for all questionnaires. Ordered by Created date, latest first.</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=Array of QAS|Name=<nowiki>QAS_getByUserResourceId</nowiki>|Parameters=
 +
{{CGscriptParameters_Template|Type=int|Name=<nowiki>userResourceId</nowiki>|Description=<nowiki>User resource id. 0 to use current.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=Array of ints|Name=<nowiki>questionnaireResourceIds</nowiki>|Description=<nowiki>Limit list to these questionnaires</nowiki>}}
 +
|Description=<nowiki>Get a list of qas by the specified user for all questionnaires. Ordered by Created date, latest first.</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=Array of QAS|Name=<nowiki>QAS_getByUserResourceId</nowiki>|Parameters=
 
{{CGscriptMethods_Template|ReturnType=Array of QAS|Name=<nowiki>QAS_getByUserResourceId</nowiki>|Parameters=
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>userResourceId</nowiki>|Description=<nowiki>User resource id. 0 to use current.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=<nowiki>questionnaireResourceId</nowiki>|Description=<nowiki>Questionnaire resource id</nowiki>}}
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>userResourceId</nowiki>|Description=<nowiki>User resource id. 0 to use current.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=<nowiki>questionnaireResourceId</nowiki>|Description=<nowiki>Questionnaire resource id</nowiki>}}
|Description=<nowiki>Get a list of qas by the specified user and questionnaire.</nowiki>}}
+
|Description=<nowiki>Get a list of qas by the specified user and questionnaire. Ordered by Created date, latest first.</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=Array of QAS|Name=<nowiki>QAS_getByUserResourceId</nowiki>|Parameters=
 
{{CGscriptMethods_Template|ReturnType=Array of QAS|Name=<nowiki>QAS_getByUserResourceId</nowiki>|Parameters=
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>userResourceId</nowiki>|Description=<nowiki>User resource id. 0 to use current.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=<nowiki>questionnaireResourceId</nowiki>|Description=<nowiki>Questionnaire resource id</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=bool|Name=<nowiki>createIfNone</nowiki>|Description=<nowiki>Create a new one if there are none</nowiki>}}
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>userResourceId</nowiki>|Description=<nowiki>User resource id. 0 to use current.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=<nowiki>questionnaireResourceId</nowiki>|Description=<nowiki>Questionnaire resource id</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=bool|Name=<nowiki>createIfNone</nowiki>|Description=<nowiki>Create a new one if there are none</nowiki>}}
|Description=<nowiki>Get a list of qas by the specified user and questionnaire.</nowiki>}}
+
|Description=<nowiki>Get a list of qas by the specified user and questionnaire. Ordered by Created date, latest first.</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=Array of QAS|Name=<nowiki>QAS_getByUserResourceId</nowiki>|Parameters=
 +
{{CGscriptParameters_Template|Type=int|Name=<nowiki>userResourceId</nowiki>|Description=<nowiki>User resource id. 0 to use current.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=<nowiki>questionnaireResourceId</nowiki>|Description=<nowiki>Questionnaire resource id</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=bool|Name=<nowiki>createIfNone</nowiki>|Description=<nowiki>Create a new one if there are none</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=bool|Name=<nowiki>setTestIfCreate</nowiki>|Description=<nowiki>If creating new, set as test</nowiki>}}
 +
|Description=<nowiki>Get a list of qas by the specified user and questionnaire. Ordered by Created date, latest first.</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=Array of QAS|Name=<nowiki>QAS_getByUserResourceIds</nowiki>|Parameters=
 
{{CGscriptMethods_Template|ReturnType=Array of QAS|Name=<nowiki>QAS_getByUserResourceIds</nowiki>|Parameters=
{{CGscriptParameters_Template|Type=Unknown|Name=<nowiki>userResourceIds</nowiki>|Description=<nowiki>List of user resource id</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=<nowiki>questionnaireResourceId</nowiki>|Description=<nowiki>Questionnaire resource id</nowiki>}}
+
{{CGscriptParameters_Template|Type=Array of ints|Name=<nowiki>userResourceIds</nowiki>|Description=<nowiki>List of user resource id</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=<nowiki>questionnaireResourceId</nowiki>|Description=<nowiki>Questionnaire resource id</nowiki>}}
|Description=<nowiki>Get a list of qas by the specified users and questionnaire.</nowiki>}}
+
|Description=<nowiki>Get a list of qas by the specified users and questionnaire. Ordered by Created date, latest first.</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>QAS_getCallStack</nowiki>|Description=<nowiki>Get the call stack of current context qas. Only works on subs (called qas) when called from the questionnaire viewer.</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>QAS_getCallStack</nowiki>|Description=<nowiki>Get the call stack of current context qas. Only works on subs (called qas) when called from the questionnaire viewer.</nowiki>}}
{{CGscriptMethods_Template|ReturnType=Array of numbers|Name=<nowiki>QAS_getCATIListAppointments</nowiki>|Description=<nowiki>Return the list of qas that has appointments for the current user for the given questionnaire.</nowiki>}}
+
{{CGscriptMethods_Template|ReturnType=Array of ints|Name=<nowiki>QAS_getCATIListAppointments</nowiki>|Description=<nowiki>Return the list of qas that has appointments for the current user for the given questionnaire.</nowiki>}}
{{CGscriptMethods_Template|ReturnType=Array of numbers|Name=<nowiki>QAS_getCATIListAppointments</nowiki>|Parameters=
+
{{CGscriptMethods_Template|ReturnType=Array of ints|Name=<nowiki>QAS_getCATIListAppointments</nowiki>|Parameters=
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>questionnaireResourceId</nowiki>|Description=<nowiki>Questionnaire resource id. Use 0 to use context</nowiki>}}
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>questionnaireResourceId</nowiki>|Description=<nowiki>Questionnaire resource id. Use 0 to use context</nowiki>}}
 
|Description=<nowiki>Return the list of qas that has appointments for the current user for the given questionnaire.</nowiki>}}
 
|Description=<nowiki>Return the list of qas that has appointments for the current user for the given questionnaire.</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=QAS|Name=<nowiki>QAS_getCurrentQAS</nowiki>|Description=<nowiki>Fetch current context qas.</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=QAS|Name=<nowiki>QAS_getCurrentQAS</nowiki>|Description=<nowiki>Fetch current context qas.</nowiki>}}
{{CGscriptMethods_Template|ReturnType=Array of numbers|Name=<nowiki>QAS_getIdsByBulkMail</nowiki>|Parameters=
+
{{CGscriptMethods_Template|ReturnType=Array of ints|Name=<nowiki>QAS_getIdsByBulkMail</nowiki>|Parameters=
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>bulkMailResourceId</nowiki>|Description=<nowiki>Resource id of the bulkmail to get info from</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=<nowiki>questionnaireResourceId</nowiki>|Description=<nowiki>Resource id of the questionnaire to get info from</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=bool|Name=<nowiki>getLatest</nowiki>|Description=<nowiki>If true, only fetch those that got the most recent mailout</nowiki>}}
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>bulkMailResourceId</nowiki>|Description=<nowiki>Resource id of the bulkmail to get info from</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=<nowiki>questionnaireResourceId</nowiki>|Description=<nowiki>Resource id of the questionnaire to get info from</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=bool|Name=<nowiki>getLatest</nowiki>|Description=<nowiki>If true, only fetch those that got the most recent mailout</nowiki>}}
 
|Description=<nowiki>Return a list of all qas ids who received a given bulkmail.</nowiki>}}
 
|Description=<nowiki>Return a list of all qas ids who received a given bulkmail.</nowiki>}}
Line 151: Line 169:
 
|Description=<nowiki>Fetch existing qas. Returns empty if qas is deleted</nowiki>}}
 
|Description=<nowiki>Fetch existing qas. Returns empty if qas is deleted</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=Array of QAS|Name=<nowiki>QAS_getQASByIds</nowiki>|Parameters=
 
{{CGscriptMethods_Template|ReturnType=Array of QAS|Name=<nowiki>QAS_getQASByIds</nowiki>|Parameters=
{{CGscriptParameters_Template|Type=Unknown|Name=<nowiki>qasIds</nowiki>|Description=<nowiki>Ids of the questionnaire</nowiki>}}
+
{{CGscriptParameters_Template|Type=Array of ints|Name=<nowiki>qasIds</nowiki>|Description=<nowiki>Ids of the questionnaire</nowiki>}}
 
|Description=<nowiki>Fetch existing qas.</nowiki>}}
 
|Description=<nowiki>Fetch existing qas.</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=object|Name=<nowiki>QAS_getSampleRuleId</nowiki>|Description=<nowiki>Return the sample rule id for the current context qas.</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=object|Name=<nowiki>QAS_getSampleRuleId</nowiki>|Description=<nowiki>Return the sample rule id for the current context qas.</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=bool|Name=<nowiki>QAS_hasCurrentQAS</nowiki>|Description=<nowiki>True if there is a context qas.</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>QAS_initAllQuestionnaires</nowiki>|Parameters=
 +
{{CGscriptParameters_Template|Type=Array of QAS|Name=<nowiki>qas</nowiki>|Description=<nowiki>List of qas</nowiki>}}
 +
|Description=<nowiki>Initialize all questionnaires from the db in an optimized way.</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>QAS_initAllUsers</nowiki>|Parameters=
 
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>QAS_initAllUsers</nowiki>|Parameters=
 
{{CGscriptParameters_Template|Type=Array of QAS|Name=<nowiki>qas</nowiki>|Description=<nowiki>List of qas</nowiki>}}
 
{{CGscriptParameters_Template|Type=Array of QAS|Name=<nowiki>qas</nowiki>|Description=<nowiki>List of qas</nowiki>}}
Line 159: Line 181:
 
{{CGscriptMethods_Template|ReturnType=QAS|Name=<nowiki>QAS_new</nowiki>|Parameters=
 
{{CGscriptMethods_Template|ReturnType=QAS|Name=<nowiki>QAS_new</nowiki>|Parameters=
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>questionnaireResourceId</nowiki>|Description=<nowiki>Questionnaire resource id</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=<nowiki>userResourceId</nowiki>|Description=<nowiki>User resource id. 0 to use current.</nowiki>}}
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>questionnaireResourceId</nowiki>|Description=<nowiki>Questionnaire resource id</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=<nowiki>userResourceId</nowiki>|Description=<nowiki>User resource id. 0 to use current.</nowiki>}}
 +
|Description=<nowiki>Create new qas.</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=QAS|Name=<nowiki>QAS_new</nowiki>|Parameters=
 +
{{CGscriptParameters_Template|Type=int|Name=<nowiki>questionnaireResourceId</nowiki>|Description=<nowiki>Questionnaire resource id</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=<nowiki>userResourceId</nowiki>|Description=<nowiki>User resource id. 0 to use current.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=bool|Name=<nowiki>setTest</nowiki>|Description=<nowiki>Set QAS to test.</nowiki>}}
 
|Description=<nowiki>Create new qas.</nowiki>}}
 
|Description=<nowiki>Create new qas.</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=QAS|Name=<nowiki>QAS_new</nowiki>|Parameters=
 
{{CGscriptMethods_Template|ReturnType=QAS|Name=<nowiki>QAS_new</nowiki>|Parameters=
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>questionnaireResourceId</nowiki>|Description=<nowiki>Questionnaire resource id</nowiki>}}
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>questionnaireResourceId</nowiki>|Description=<nowiki>Questionnaire resource id</nowiki>}}
|Description=<nowiki>Create new qas.</nowiki>}}
+
|Description=<nowiki>Create new qas for current user.</nowiki>}}
{{CGscriptMethods_Template|ReturnType=Array of numbers|Name=<nowiki>QAS_reset</nowiki>|Parameters=
+
{{CGscriptMethods_Template|ReturnType=QAS|Name=<nowiki>QAS_new</nowiki>|Parameters=
{{CGscriptParameters_Template|Type=Unknown|Name=<nowiki>qasIds</nowiki>|Description=<nowiki>List of qas ids</nowiki>}}
+
{{CGscriptParameters_Template|Type=int|Name=<nowiki>questionnaireResourceId</nowiki>|Description=<nowiki>Questionnaire resource id</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=bool|Name=<nowiki>setTest</nowiki>|Description=<nowiki>Set QAS to test.</nowiki>}}
 +
|Description=<nowiki>Create new qas for current user.</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=Array of ints|Name=<nowiki>QAS_reset</nowiki>|Parameters=
 +
{{CGscriptParameters_Template|Type=Array of ints|Name=<nowiki>qasIds</nowiki>|Description=<nowiki>List of qas ids</nowiki>}}
 
|Description=<nowiki>Reset QAS without delete data. Returns list of qas that qas NOT reset.</nowiki>}}
 
|Description=<nowiki>Reset QAS without delete data. Returns list of qas that qas NOT reset.</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>QAS_resetFullCallstack</nowiki>|Parameters=
 
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>QAS_resetFullCallstack</nowiki>|Parameters=
Line 172: Line 200:
 
{{CGscriptParameters_Template|Type=QAS|Name=<nowiki>qas</nowiki>|Description=<nowiki>Qas to save</nowiki>}}
 
{{CGscriptParameters_Template|Type=QAS|Name=<nowiki>qas</nowiki>|Description=<nowiki>Qas to save</nowiki>}}
 
|Description=<nowiki>Fetch current context qas.</nowiki>}}
 
|Description=<nowiki>Fetch current context qas.</nowiki>}}
{{CGscriptMethods_Template|ReturnType=Array of numbers|Name=<nowiki>QAS_setCompleted</nowiki>|Parameters=
+
{{CGscriptMethods_Template|ReturnType=Array of ints|Name=<nowiki>QAS_setCompleted</nowiki>|Parameters=
{{CGscriptParameters_Template|Type=Unknown|Name=<nowiki>qasIds</nowiki>|Description=<nowiki>List of qas ids</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=bool|Name=<nowiki>completed</nowiki>|Description=<nowiki>True to set all to completed, false to unset all</nowiki>}}
+
{{CGscriptParameters_Template|Type=Array of ints|Name=<nowiki>qasIds</nowiki>|Description=<nowiki>List of qas ids</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=bool|Name=<nowiki>completed</nowiki>|Description=<nowiki>True to set all to completed, false to unset all</nowiki>}}
 
|Description=<nowiki>Set or unset completed state of given qas. When completing, EndDate is set to now, and StartDate is also set to now unless it was already set. Returns list of qas that qas NOT deleted data for.</nowiki>}}
 
|Description=<nowiki>Set or unset completed state of given qas. When completing, EndDate is set to now, and StartDate is also set to now unless it was already set. Returns list of qas that qas NOT deleted data for.</nowiki>}}
 
}}
 
}}
 +
=== <span style="color:#DF8621">'''Note'''</span> ===
 +
Every function in QAS class that takes userResourceId such as QAS new, QAS_new, QAS_getByUserResourceId, where userResourceId:
 +
* 0 is use current user
 +
* -1 to force no user
 +
* -2 to anonymous
 +
 +
=== <span style="color:#DF8621">'''Examples'''</span> ===
 +
<span style="color:#DF8621"> Get question already viewed</span>
 +
<source lang="javascript">
 +
//The qnaire have 7 questions in order: Intro,Q1,Q2,Q3,Q4,Q5,End
 +
//And the qas is partly at Q4
 +
QAS qas = new QAS (123456);
 +
print(qas.IsInSyncWithQuestionnaire);// true
 +
print(qas.QuestionSequence);//{Intro,Q1,Q2,Q3,Q4,Q5,End}
 +
print(qas.ViewedQuestions);//{3,2,1,0}
 +
print(qas.QuestionSequenceIndex);//4
 +
</source>

Latest revision as of 04:39, 23 July 2020

QAS


Questionnaire answer sheet.

Parent class

Inherits from Array

Constructors

  • (int qasId "Id of the questionnaire") - Fetch existing qas.
  • (string qasGuid "Id of the questionnaire") - Fetch existing qas.
  • (int QuestionnaireResourceId "Questionnaire resource id", int UserResourceId "User resource id. 0 to use current.") - Create new qas.
  • (int QuestionnaireResourceId "Questionnaire resource id", int UserResourceId "User resource id. 0 to use current.", bool setTest "Set QAS to test.") - Create new qas.

Methods

  • (From array) bool Any(Function predicate "A function that takes 1 parameter of the types in the array, and return true/false") - Return true if the array contains the element using the given function.
  • (From array) bool Contains(object element "Element to check for") - Return true if the array contains the element using the normal equal operator.
  • (From array) array Except(array elements "Elements to remove") - Return all elements that does not exist in the other collection.
  • (From array) object First(Function selector "A function to test each element for a condition.") - Returns the first element in a sequence that satisfies a specified condition.
  • (From array) object FirstOrDefault(Function selector "A function to test each element for a condition.") - Returns the first element in a sequence that satisfies a specified condition or empty if not found.
  • (From array) Empty Foreach(Function function "A function that takes 1 parameter of the types in the array, and an optional 2nd parameter that is the index") - Filters a sequence of values based on a predicate.
  • (From array) int Frequency(number number "The number to search for") - Counts the number of times a given Number object exists in the Array. Can only use if all the elements are of type Number
  • object this[] { get; }(int index "Index") - Backward-compatible indexer
  • QAS GetCaller() - Return the QAS that used GotoQuestionnaire to jump to this QAS. Empty if nothing on callstack
  • Empty GotoQuestionnaire() - Jump to this qas. This function never returns
  • (From array) int IndexOf(object element "Element to search for") - Return index of the given element, or -1.
  • (From array) bool IsCharacterArray() - check if array is an array of characters
  • (From array) bool IsNumericArray() - check if array is an array of integer numbers
  • (From array) bool IsStringArray() - check if array is an array of string
  • Empty MakeCurrentQAS() - Set as the current context qas.
  • (From array) array OrderBy(Function comparer "Function that compares two objects of the same type. Must return a signed integer that indicates the relative values of first param A and second param B. Value Less than 0 : A is less than B.Value 0 : A equals B.Value Greater than 0 : A is greater than B.It can also be a function that takes 1 parameter and returns a string or number.") - Sorts the elements of a sequence in ascending order by using a specified comparer.
  • (From array) Empty Randomize() - Randomize the order of the elements in the current array.
  • Empty Reset() - Reset progress in current QAS without delete data.
  • (From array) array Reverse() - Returns an array with all the elements in the opposite order.
  • Empty Save() - Save qas.
  • (From array) array Select(Function selector "A transform function to apply to each element.") - Projects each element of a sequence into a new form.
  • (From array) array SelectMany(Function selector "A transform function to get each sub array.") - Projects each array element of a sequence into a new form.
  • Empty this[] { set; }(int index "Index", object value "Value to set") - Backward-compatible indexer
  • (From array) array Skip(int n "How many elements to skip") - Get all but the n first elements.
  • (From array) array Take(int n "How many elements to take") - Get the n first elements.
  • (From array) Dictionary ToDictionary(Function keySelector "A transform function to get the key of each element.") - Return a dictionary with the elements of the array.
  • (From array) Dictionary ToDictionary(Function keySelector "A transform function to get the key of each element.", Function valueSelector "A transform function to get the value of each element.") - Return a dictionary with the elements of the array.
  • (From Array) string ToString() - The string representation of the object.
  • (From array) array Where(Function predicate "A function that takes 1 parameter of the types in the array, and an optional 2nd parameter that is the index and return true/false") - Filters a sequence of values based on a predicate.

Properties

  • string AccessCode { get; } - Get the unique access code for use in login or sms-style url.
  • (From array) number Average { get; } - Average of the objects in the Array object. Can only use if all the elements are of type Number
  • DateTime CatiAppointment { get; set; } - When should Cati attempt to call this Qas, assuming they are on appointment or retry list.
  • DateTime CatiCallTime { get; } - If meeting or retry, when will this qas be schedule for.
  • int CatiList { get; set; } - Which type of cati call. 1 = main, 2 = ongoing, 3 = appointment, 4 = done, 5 = retry.
  • int CatiPriority { get; set; } - Priority of call. Only used on mainlist.
  • bool Completed { get; set; } - Get/set completed. Warning: Quotas will not be updated on save, use setUserProjectQuestionnaireCompleted/setRPQCompleted.
  • DateTime CreatedDate { get; } - When was this qas created.
  • bool Deleted { get; } - Get if marked deleted.
  • DateTime EndDate { get; set; } - When was this qas finished.
  • string Guid { get; } - Id of the QAS in GUID format
  • int Id { get; } - Id of the QAS
  • bool IsInSyncWithQuestionnaire { get; } - Return true if the version the Qas was last active on is also the current questionnaire version.
  • (From array) number Max { get; } - Largest of all the objects in the Array object. Can only use if all the elements are of type Number
  • (From array) number Min { get; } - Smallest of all the objects in the Array object. Can only use if all the elements are of type Number
  • string ObjectTypeName { get; } - The name of the type of object.
  • int QuestionnaireResourceId { get; } - Resource Id of the questionnaire.
  • Array of string QuestionSequence { get; } - Get the expected sequence of questions to be viewed following the question group rules etc, but not any CgScript or Conditions, only accurate if IsInSyncWithQuestionnaire is true
  • int QuestionSequenceIndex { get; } - Get the index into QuestionSequence of what is current question, only accurate if IsInSyncWithQuestionnaire is true
  • int SampleRuleId { get; } - Id of the sample rule
  • DateTime StartDate { get; set; } - When was this qas started.
  • int Status { get; set; } - Current status of qas. See UserProjectQuestionnaire_Status_xxx/RPQ_Status_xxx.
  • (From array) number Sum { get; } - Sum of all the objects in the Array object. Can only use if all the elements are of type Number
  • bool Test { get; set; } - Get/set if test qas.
  • (From object) TypeInformation TypeInformation { get; } - Get information about this class.
  • int UserId { get; set; } - Get/set user the qas belongs to. May be 0 for anonymous
  • int UserResourceId { get; set; } - Get/set user the qas belongs to. May be 0 for anonymous
  • Array of int ViewedQuestions { get; } - Get the questions the viewed as index into QuestionSequence, only accurate if IsInSyncWithQuestionnaire is true

Static Methods

  • Array of int QAS_anonymize(Array of int qasIds "List of qas ids") - Delete all user references for the qas and data. Returns list of qas that qas NOT anonymized.
  • string QAS_createUniqueAccessCode(int qasId "Id of the questionnaire") - Return the unique access code for this qas.
  • Array of int QAS_deleteData(Array of int qasIds "List of qas ids") - Delete data for the given qas. Returns list of qas that qas NOT deleted data for.
  • bool QAS_exists(int questionnaireResourceId "Questionnaire resource id") - Check if a QAS exists.
  • bool QAS_exists(int questionnaireResourceId "Questionnaire resource id", int userResourceId "User resource id. 0 to use current.") - Check if a QAS exists.
  • object QAS_flushCallStack() - Flush the call stack of current context qas and return what stack was. Only works on subs (called qas) when called from the questionnaire viewer.
  • QAS QAS_getByGuid(string qasGuid "Id of the questionnaire") - Fetch existing qas.
  • Array of QAS QAS_getByQuestionnaireResourceId(int questionnaireResourceId "Questionnaire resource id") - Fetch existing qas.
  • QAS QAS_getByUniqueAccessCode(string accessCode "Access code") - Find qas by the access code.
  • Array of QAS QAS_getByUserResourceId(int userResourceId "User resource id. 0 to use current.") - Get a list of qas by the specified user for all questionnaires. Ordered by Created date, latest first.
  • Array of QAS QAS_getByUserResourceId(int userResourceId "User resource id. 0 to use current.", Array of int questionnaireResourceIds "Limit list to these questionnaires") - Get a list of qas by the specified user for all questionnaires. Ordered by Created date, latest first.
  • Array of QAS QAS_getByUserResourceId(int userResourceId "User resource id. 0 to use current.", int questionnaireResourceId "Questionnaire resource id") - Get a list of qas by the specified user and questionnaire. Ordered by Created date, latest first.
  • Array of QAS QAS_getByUserResourceId(int userResourceId "User resource id. 0 to use current.", int questionnaireResourceId "Questionnaire resource id", bool createIfNone "Create a new one if there are none") - Get a list of qas by the specified user and questionnaire. Ordered by Created date, latest first.
  • Array of QAS QAS_getByUserResourceId(int userResourceId "User resource id. 0 to use current.", int questionnaireResourceId "Questionnaire resource id", bool createIfNone "Create a new one if there are none", bool setTestIfCreate "If creating new, set as test") - Get a list of qas by the specified user and questionnaire. Ordered by Created date, latest first.
  • Array of QAS QAS_getByUserResourceIds(Array of int userResourceIds "List of user resource id", int questionnaireResourceId "Questionnaire resource id") - Get a list of qas by the specified users and questionnaire. Ordered by Created date, latest first.
  • array QAS_getCallStack() - Get the call stack of current context qas. Only works on subs (called qas) when called from the questionnaire viewer.
  • Array of int QAS_getCATIListAppointments() - Return the list of qas that has appointments for the current user for the given questionnaire.
  • Array of int QAS_getCATIListAppointments(int questionnaireResourceId "Questionnaire resource id. Use 0 to use context") - Return the list of qas that has appointments for the current user for the given questionnaire.
  • QAS QAS_getCurrentQAS() - Fetch current context qas.
  • Array of int QAS_getIdsByBulkMail(int bulkMailResourceId "Resource id of the bulkmail to get info from", int questionnaireResourceId "Resource id of the questionnaire to get info from", bool getLatest "If true, only fetch those that got the most recent mailout") - Return a list of all qas ids who received a given bulkmail.
  • object QAS_getLastInterviewerId() - Return the user unique id for final interviewer of current context qas.
  • Dictionary QAS_getParameters() - Return the url parameters given in the url that opened the viewer for this qas. Only works when called from viewer.
  • QAS QAS_getQASById(int qasId "Id of the questionnaire") - Fetch existing qas. Returns empty if qas is deleted
  • Array of QAS QAS_getQASByIds(Array of int qasIds "Ids of the questionnaire") - Fetch existing qas.
  • object QAS_getSampleRuleId() - Return the sample rule id for the current context qas.
  • bool QAS_hasCurrentQAS() - True if there is a context qas.
  • Empty QAS_initAllQuestionnaires(Array of QAS qas "List of qas") - Initialize all questionnaires from the db in an optimized way.
  • Empty QAS_initAllUsers(Array of QAS qas "List of qas") - Initialize all users from the db in an optimized way.
  • QAS QAS_new(int questionnaireResourceId "Questionnaire resource id", int userResourceId "User resource id. 0 to use current.") - Create new qas.
  • QAS QAS_new(int questionnaireResourceId "Questionnaire resource id", int userResourceId "User resource id. 0 to use current.", bool setTest "Set QAS to test.") - Create new qas.
  • QAS QAS_new(int questionnaireResourceId "Questionnaire resource id") - Create new qas for current user.
  • QAS QAS_new(int questionnaireResourceId "Questionnaire resource id", bool setTest "Set QAS to test.") - Create new qas for current user.
  • Array of int QAS_reset(Array of int qasIds "List of qas ids") - Reset QAS without delete data. Returns list of qas that qas NOT reset.
  • Empty QAS_resetFullCallstack(QAS qas "QAS to reset", bool resetCati "True to also reset cati settings") - Reset QAS and all children without delete data.
  • Empty QAS_save(QAS qas "Qas to save") - Fetch current context qas.
  • Array of int QAS_setCompleted(Array of int qasIds "List of qas ids", bool completed "True to set all to completed, false to unset all") - Set or unset completed state of given qas. When completing, EndDate is set to now, and StartDate is also set to now unless it was already set. Returns list of qas that qas NOT deleted data for.

Note

Every function in QAS class that takes userResourceId such as QAS new, QAS_new, QAS_getByUserResourceId, where userResourceId:

  • 0 is use current user
  • -1 to force no user
  • -2 to anonymous

Examples

Get question already viewed

//The qnaire have 7 questions in order: Intro,Q1,Q2,Q3,Q4,Q5,End
//And the qas is partly at Q4
QAS qas = new QAS (123456);
print(qas.IsInSyncWithQuestionnaire);// true
print(qas.QuestionSequence);//{Intro,Q1,Q2,Q3,Q4,Q5,End}
print(qas.ViewedQuestions);//{3,2,1,0}
print(qas.QuestionSequenceIndex);//4