Difference between revisions of "DataCacheSpecification class"

From Catglobe Wiki
Jump to: navigation, search
(Created page with "<p style="color:#000099; font-size:14px;"><strong>DataCacheSpecification : Represents a Data Cache specification.</strong></p> <p>  </p> <p> <span style="color:#a52a2a;"><...")
 
 
(42 intermediate revisions by 9 users not shown)
Line 1: Line 1:
<p style="color:#000099; font-size:14px;"><strong>DataCacheSpecification : Represents a Data Cache specification.</strong></p>
+
{{CGscriptClass_Template
<p>
+
|Name=<nowiki>DataCacheSpecification</nowiki>
&nbsp;</p>
+
|Description=<nowiki>Represents a DataCache specification.</nowiki>
<p>
+
|InheritsFrom=object|Constructors=
<span style="color:#a52a2a;"><strong>Constructors</strong></span></p>
+
{{CGscriptConstructors_Template|Description=<nowiki>Instanciate an existing instance using the current context datacache</nowiki>}}
<ul>
+
{{CGscriptConstructors_Template|Parameters=
<li style="color:#000000;">
+
{{CGscriptParameters_Template|Type=int|Name=<nowiki>ResourceId</nowiki>|Description=<nowiki>Resource Id of the DataCache</nowiki>}}
<span style="color:#000000;"><strong>()</strong> - Instanciate a new instance using the current datacache context.</span></li>
+
|Description=<nowiki>Instanciate an existing instance using the resource id of a datacache</nowiki>}}
<li style="color:#000000;">
+
{{CGscriptConstructors_Template|Parameters=
<span style="color:#000000;"><strong>(number ResourceId)</strong> - Instanciate a new instance using the resource id of a datacache</span></li>
+
{{CGscriptParameters_Template|Type=string|Name=<nowiki>ResourceName</nowiki>|Description=<nowiki>Resource name of the new DataCache</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>Questionnaire Ids</nowiki>|Description=<nowiki>List of Questionnaires to use in the creation. Must all belong to same template</nowiki>}}
<li style="color:#000000;">
+
|Description=<nowiki>Create a new datacache using quick setup</nowiki>}}
<span style="color:#000000;"><strong>(string ResourceName, array QuestionnaireIds)</strong> - Create a new datacache using quick setup. QuestionnaireIds is an array of Questionnaire Ids to use in the creation. Must all belong to same questionnaire template.</span></li>
+
|Methods=
</ul>
+
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>AddFilter</nowiki>|Parameters=
<p>
+
{{CGscriptParameters_Template|Type=string|Name=<nowiki>filterQuestionLabel</nowiki>|Description=<nowiki>Question to apply filter to. If empty, then clear current filters</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>filterValue</nowiki>|Description=<nowiki>Value of the filter</nowiki>}}
<span style="color:#a52a2a;"><strong>Methods</strong></span></p>
+
|Description=<nowiki>Add a filter to the DataCache</nowiki>}}
<ul>
+
{{CGscriptMethods_Template|ReturnType=bool|Name=<nowiki>AddQuestionnaire</nowiki>|Parameters=
<li style="color:#000000;">
+
{{CGscriptParameters_Template|Type=int|Name=<nowiki>questionnaireResourceId</nowiki>|Description=<nowiki>Questionnaire to add</nowiki>}}
<span style="color: rgb(0, 0, 0);"><strong>Empty AddFilter(string filterQuestionLabel, string filterValue)</strong> - Add a filter to the DataCache.</span><span style="color: rgb(0, 0, 0);"> filterQuestionLabel is Question to apply filter to. If empty, then clear current filters.</span> <span style="color: rgb(0, 0, 0);">filterValue is Value of the filter.</span></li>
+
|Description=<nowiki>Add another questionnaire to the datacache. Return false if already added</nowiki>}}
<li style="color:#000000;">
+
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>ClearFilter</nowiki>|Description=<nowiki>Remove all filters from the DataCache</nowiki>}}
<span style="color: rgb(0, 0, 0);"><strong>AnyType EvalWhere(string whereExpression)</strong> - Evaluate a single where expression up against the current DataCache. whereExpression is an expression to execute. It must contain &#39;where&#39; and NOT start with a equal sign, and have 1 and only one semicolon in it.</span></li>
+
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>ClearSecondaryQuestionnaireJoinType</nowiki>|Description=<nowiki>Delete all the secondary questionnaires which are joined with the primary</nowiki>}}
<li style="color:#000000;">
+
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>CreateAllColumnsForAllQuestions</nowiki>|Parameters=
<span style="color: rgb(0, 0, 0);"><strong>Dictionary EvalWhere(Dictionary whereExpressions)</strong> - Evaluate a number of where expressions up against the current DataCache. If there are 2 or more expressions, the result is cached. Context weight and filters are ignored. whereExpressions are expressions to execute. They must contain &#39;where&#39; and MAY start with a equal sign, and have 1 and only one semicolon in it.</span></li>
+
{{CGscriptParameters_Template|Type=int|Name=<nowiki>questionnaireResourceId</nowiki>|Description=<nowiki>Set the associated questionnaire. Set to 0 to use primary questionnaire</nowiki>}}
<li style="color:#000000;">
+
|Description=<nowiki>Find and create all column for all questions. They still need to be saved individually to be added.</nowiki>}}
<span style="color: rgb(0, 0, 0);"><strong>Dictionary EvalWhere(Dictionary whereExpressions, string weight)</strong> - Evaluate a number of where expressions up against the current DataCache using a weight. If there are 2 or more expressions, the result is cached. Context weight and filters are ignored. whereExpressions are expressions to execute. They must contain &#39;where&#39; and MAY start with a equal sign, and have 1 and only one semicolon in it. weight is column name of the weight to use in filter.</span></li>
+
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>CreateAllColumnsForQuestion</nowiki>|Parameters=
<li style="color:#000000;">
+
{{CGscriptParameters_Template|Type=string|Name=<nowiki>question</nowiki>|Description=<nowiki>QuestionLabel for the question you want all the dcs columns for</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=<nowiki>questionnaireResourceId</nowiki>|Description=<nowiki>Set the associated questionnaire. Set to 0 to use primary questionnaire</nowiki>}}
<span style="color:#000000;"><strong>Empty MakeContext()</strong> - Make the current Data Cache as the DCS Context</span></li>
+
|Description=<nowiki>Find and create all column for a given question. They still need to be saved individually to be added.</nowiki>}}
<li style="color:#000000;">
+
{{CGscriptMethods_Template|ReturnType=Dictionary|Name=<nowiki>CreateAllColumnsForQuestions</nowiki>|Parameters=
<span style="color:#000000;"><strong>Empty Save()</strong> - Save the Data Cache but not REBUILD the Data Cache.</span></li>
+
{{CGscriptParameters_Template|Type=array|Name=<nowiki>questions</nowiki>|Description=<nowiki>QuestionLabels for the questions you want all the dcs columns for</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=<nowiki>questionnaireResourceId</nowiki>|Description=<nowiki>Set the associated questionnaire. Set to 0 to use primary questionnaire</nowiki>}}
<li style="color:#000000;">
+
|Description=<nowiki>Find and create all column for a given question. They still need to be saved individually to be added.</nowiki>}}
<span style="color:#000000;"><strong>string ToString()</strong> - The string representation of the object.</span></li>
+
{{CGscriptMethods_Template|ReturnType=bool|Name=<nowiki>DeleteSecondaryQuestionnaireJoinType</nowiki>|Parameters=
</ul>
+
{{CGscriptParameters_Template|Type=int|Name=<nowiki>secondaryQuestionnaireResourceId</nowiki>|Description=<nowiki>Which secondary questionnaire</nowiki>}}
<p>
+
|Description=<nowiki>Delete the secondary questionnaire which is joined with the primary</nowiki>}}
<span style="color:#a52a2a;"><strong>Properties</strong></span></p>
+
{{CGscriptMethods_Template|ReturnType=object|Name=<nowiki>EvalWhere</nowiki>|Parameters=
<ul>
+
{{CGscriptParameters_Template|Type=string|Name=<nowiki>whereExpression</nowiki>|Description=<nowiki>The expression to execute. It must contain 'where' and NOT start with a equal sign, and have 1 and only one semicolon in it</nowiki>}}
<li style="color:#000000;">
+
|Description=<nowiki>Evaluate a single where expression up against the current DataCache</nowiki>}}
<span style="color:#000000;"><strong>bool AutoUpdate HasGetter HasSetter</strong> - Get/Set Auto Update</span></li>
+
{{CGscriptMethods_Template|ReturnType=Dictionary|Name=<nowiki>EvalWhere</nowiki>|Parameters=
<li style="color:#000000;">
+
{{CGscriptParameters_Template|Type=Dictionary|Name=<nowiki>whereExpressions</nowiki>|Description=<nowiki>The expressions to execute. They must contain 'where' and MAY start with a equal sign, and have 1 and only one semicolon in it</nowiki>}}
<span style="color:#000000;"><strong>bool BuildWithWeight HasGetter HasSetter</strong> - Get/Set if the DataCache should be built using weights</span></li>
+
|Description=<nowiki>OBSOLETE, use EvalWhereExps! Evaluate a number of where expressions up against the current DataCache. If there are 2 or more expressions, the result is cached. Context weight and filters are ignored.</nowiki>}}
<li style="color:#000000;">
+
{{CGscriptMethods_Template|ReturnType=Dictionary|Name=<nowiki>EvalWhere</nowiki>|Parameters=
<span style="color:#000000;"><strong>number CachedRecords HasGetter</strong>&nbsp; - How many records does the DataCache currently hold</span></li>
+
{{CGscriptParameters_Template|Type=Dictionary|Name=<nowiki>whereExpressions</nowiki>|Description=<nowiki>The expressions to execute. They must contain 'where' and MAY start with a equal sign, and have 1 and only one semicolon in it</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>weight</nowiki>|Description=<nowiki>Column name of the weight to use in filter</nowiki>}}
<li style="color:#000000;">
+
|Description=<nowiki>OBSOLETE, use EvalWhereExps! Evaluate a number of where expressions up against the current DataCache using a weight. If there are 2 or more expressions, the result is cached. Context weight and filters are ignored.</nowiki>}}
<span style="color:#000000;"><strong>array ColumnNames HasGetter</strong>&nbsp; - List of Column names</span></li>
+
{{CGscriptMethods_Template|ReturnType=Dictionary|Name=<nowiki>EvalWhere</nowiki>|Parameters=
<li style="color:#000000;">
+
{{CGscriptParameters_Template|Type=Dictionary|Name=<nowiki>whereExpressions</nowiki>|Description=<nowiki>The expressions to execute. They must contain 'where' and MAY start with a equal sign, and have 1 and only one semicolon in it</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>weight</nowiki>|Description=<nowiki>Column name of the weight to use in filter</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>filters</nowiki>|Description=<nowiki>Extra filters that apply to all where expressions</nowiki>}}
<span style="color:#000000;"><strong>bool Completed HasGetter HasSetter</strong> - Get/Set include completed</span></li>
+
|Description=<nowiki>OBSOLETE, use EvalWhereExps! Evaluate a number of where expressions up against the current DataCache using a weight. If there are 2 or more expressions, the result is cached. Context weight and filters are ignored.</nowiki>}}
<li style="color:#000000;">
+
{{CGscriptMethods_Template|ReturnType=Dictionary|Name=<nowiki>EvalWhere</nowiki>|Parameters=
<span style="color:#000000;"><strong>bool Deleted HasGetter HasSetter</strong> - Get/Set include deleted</span></li>
+
{{CGscriptParameters_Template|Type=Dictionary|Name=<nowiki>whereExpressions</nowiki>|Description=<nowiki>The expressions to execute. They must contain 'where' and MAY start with a equal sign, and have 1 and only one semicolon in it</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>weight</nowiki>|Description=<nowiki>Column name of the weight to use in filter</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>filters</nowiki>|Description=<nowiki>Extra filters that apply to all where expressions</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>freeTextFilters</nowiki>|Description=<nowiki>Extra free text search filters that apply to all where expressions</nowiki>}}
<li style="color:#000000;">
+
|Description=<nowiki>OBSOLETE, use EvalWhereExps! Evaluate a number of where expressions up against the current DataCache using a weight. If there are 2 or more expressions, the result is cached. Context weight and filters are ignored.</nowiki>}}
<span style="color:#000000;"><strong>string Description HasGetter HasSetter</strong> - Get/Set description of the DataCache</span></li>
+
{{CGscriptMethods_Template|ReturnType=Dictionary|Name=<nowiki>EvalWhereExps</nowiki>|Parameters=
<li style="color:#000000;">
+
{{CGscriptParameters_Template|Type=Dictionary|Name=<nowiki>whereExpressions</nowiki>|Description=<nowiki>The expressions to execute. They must contain 'where' and MAY start with a equal sign, and have 1 and only one semicolon in it</nowiki>}}
<span style="color:#000000;"><strong>bool Disabled HasGetter HasSetter</strong> - Get/Set include disabled</span></li>
+
|Description=<nowiki>Evaluate a number of where expressions up against the current DataCache. If there are 2 or more expressions, the result is cached. Context weight and filters are ignored.</nowiki>}}
<li style="color:#000000;">
+
{{CGscriptMethods_Template|ReturnType=Dictionary|Name=<nowiki>EvalWhereExps</nowiki>|Parameters=
<span style="color:#000000;"><strong>bool InterviewFailed HasGetter HasSetter</strong> - Get/Set include marked as interview failed</span></li>
+
{{CGscriptParameters_Template|Type=Dictionary|Name=<nowiki>whereExpressions</nowiki>|Description=<nowiki>The expressions to execute. They must contain 'where' and MAY start with a equal sign, and have 1 and only one semicolon in it</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>weight</nowiki>|Description=<nowiki>Column name of the weight to use in filter</nowiki>}}
<li style="color:#000000;">
+
|Description=<nowiki>Evaluate a number of where expressions up against the current DataCache using a weight. If there are 2 or more expressions, the result is cached. Context weight and filters are ignored.</nowiki>}}
<span style="color:#000000;"><strong>bool InterviewSucceeded HasGetter HasSetter</strong> - Get/Set include marked as interview succeeded</span></li>
+
{{CGscriptMethods_Template|ReturnType=Dictionary|Name=<nowiki>EvalWhereExps</nowiki>|Parameters=
<li style="color:#000000;">
+
{{CGscriptParameters_Template|Type=Dictionary|Name=<nowiki>whereExpressions</nowiki>|Description=<nowiki>The expressions to execute. They must contain 'where' and MAY start with a equal sign, and have 1 and only one semicolon in it</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>weight</nowiki>|Description=<nowiki>Column name of the weight to use in filter</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>filters</nowiki>|Description=<nowiki>Extra filters that apply to all where expressions</nowiki>}}
<span style="color:#000000;"><strong>bool IsOutOfDate HasGetter</strong>&nbsp; - Does the DataCache need to be rebuilt to have the correct content</span></li>
+
|Description=<nowiki>Evaluate a number of where expressions up against the current DataCache using a weight. If there are 2 or more expressions, the result is cached. Context weight and filters are ignored.</nowiki>}}
<li style="color:#000000;">
+
{{CGscriptMethods_Template|ReturnType=Dictionary|Name=<nowiki>EvalWhereExps</nowiki>|Parameters=
<span style="color:#000000;"><strong>string Language HasGetter HasSetter</strong> - Get/Set the iso code used in building the items that depend on a specific language</span></li>
+
{{CGscriptParameters_Template|Type=Dictionary|Name=<nowiki>whereExpressions</nowiki>|Description=<nowiki>The expressions to execute. They must contain 'where' and MAY start with a equal sign, and have 1 and only one semicolon in it</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>weight</nowiki>|Description=<nowiki>Column name of the weight to use in filter</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>filters</nowiki>|Description=<nowiki>Extra filters that apply to all where expressions</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>freeTextFilters</nowiki>|Description=<nowiki>Extra free text search filters that apply to all where expressions</nowiki>}}
<li style="color:#000000;">
+
|Description=<nowiki>Evaluate a number of where expressions up against the current DataCache using a weight. If there are 2 or more expressions, the result is cached. Context weight and filters are ignored.</nowiki>}}
<span style="color:#000000;"><strong>DateTime LastUpdated HasGetter</strong>&nbsp; - Time of the last rebuild</span></li>
+
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>GetAllSecondaryQuestionnaireJoinType</nowiki>|Description=<nowiki>Get all the secondary questionnaires that are joined with the primary</nowiki>}}
<li style="color:#000000;">
+
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>GetSecondaryQuestionnaireJoinType</nowiki>|Parameters=
<span style="color:#000000;"><strong>string Name HasGetter HasSetter</strong> - Name of the DataCache resource</span></li>
+
{{CGscriptParameters_Template|Type=int|Name=<nowiki>secondaryQuestionnaireResourceId</nowiki>|Description=<nowiki>Which secondary questionnaire</nowiki>}}
<li style="color:#000000;">
+
|Description=<nowiki>Get the way secondary questionnaires are joined with the primary, default is empty,empty (userId to userId)</nowiki>}}
<span style="color:#000000;"><strong>bool Normal HasGetter HasSetter</strong> - Get/Set include normal</span></li>
+
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>MakeContext</nowiki>|Description=<nowiki>Make the current DataCache the context DataCache</nowiki>}}
<li style="color:#000000;">
+
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>Rebuild</nowiki>|Parameters=
<span style="color:#000000;"><strong>bool NotStarted HasGetter HasSetter</strong> - Get/Set include those not yet started</span></li>
+
{{CGscriptParameters_Template|Type=bool|Name=<nowiki>forceRebuild</nowiki>|Description=<nowiki>Rebuild even if dcs was already built and unchanged</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=bool|Name=<nowiki>waitForCompletion</nowiki>|Description=<nowiki>Do not return until the rebuild is complete</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=<nowiki>minAgeInMinutes</nowiki>|Description=<nowiki>Rebuild only if last build ended more than this amount of minutes ago, 0 to disable check. This supersedes forceRebuild</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=bool|Name=<nowiki>forceFull</nowiki>|Description=<nowiki>Force a complete rebuild, even if dcs is configured for partial rebuilds</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=object|Name=<nowiki>extraParameter</nowiki>|Description=<nowiki>If the dcs to build is built from a script it will get this as the 5th parameter</nowiki>}}
<li style="color:#000000;">
+
|Description=<nowiki>Rebuild the dcs. Notice this will commit the current transaction</nowiki>}}
<span style="color:#000000;"><strong>bool OutsideTarget HasGetter HasSetter</strong> - Get/Set include those marked outside target</span></li>
+
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>Rebuild</nowiki>|Parameters=
<li style="color:#000000;">
+
{{CGscriptParameters_Template|Type=bool|Name=<nowiki>forceRebuild</nowiki>|Description=<nowiki>Rebuild even if dcs was already built and unchanged</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=bool|Name=<nowiki>waitForCompletion</nowiki>|Description=<nowiki>Do not return until the rebuild is complete</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=<nowiki>minAgeInMinutes</nowiki>|Description=<nowiki>Rebuild only if last build ended more than this amount of minutes ago, 0 to disable check. This supersedes forceRebuild</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=bool|Name=<nowiki>forceFull</nowiki>|Description=<nowiki>Force a complete rebuild, even if dcs is configured for partial rebuilds</nowiki>}}
<span style="color:#000000;"><strong>bool Partly HasGetter HasSetter</strong> - Get/Set include partly completed</span></li>
+
|Description=<nowiki>Rebuild the dcs. Notice this will commit the current transaction</nowiki>}}
<li style="color:#000000;">
+
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>Rebuild</nowiki>|Parameters=
<span style="color:#000000;"><strong>array QuestionnaireIds HasGetter</strong>&nbsp; - List of the questionnaires used in the DataCache</span></li>
+
{{CGscriptParameters_Template|Type=bool|Name=<nowiki>forceRebuild</nowiki>|Description=<nowiki>Rebuild even if dcs was already built and unchanged</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=bool|Name=<nowiki>waitForCompletion</nowiki>|Description=<nowiki>Do not return until the rebuild is complete</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=<nowiki>minAgeInMinutes</nowiki>|Description=<nowiki>Rebuild only if last build ended more than this amount of minutes ago, 0 to disable check. This supersedes forceRebuild</nowiki>}}
<li style="color:#000000;">
+
|Description=<nowiki>Rebuild the dcs. Notice this will commit the current transaction</nowiki>}}
<span style="color:#000000;"><strong>number QuestionnaireTemplateId HasGetter</strong>&nbsp; - The resource id of the questionnaire template used in the DataCache</span></li>
+
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>RemoveFilter</nowiki>|Parameters=
<li style="color:#000000;">
+
{{CGscriptParameters_Template|Type=string|Name=<nowiki>filterQuestionLabel</nowiki>|Description=<nowiki>Question to apply filter to. If empty, then clear current filters</nowiki>}}
<span style="color:#000000;"><strong>bool QuotaFull HasGetter HasSetter</strong> - Get/Set include those with full quota</span></li>
+
|Description=<nowiki>Remove  a filter from the DataCache</nowiki>}}
<li style="color:#000000;">
+
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>Reset</nowiki>|Description=<nowiki>Reset to initial quick setup</nowiki>}}
<span style="color:#000000;"><strong>number ResourceId HasGetter</strong>&nbsp; - The Id of the DataCache</span></li>
+
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>Save</nowiki>|Description=<nowiki>Save the DataCache</nowiki>}}
<li style="color:#000000;">
+
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>SetSecondaryQuestionnaireJoinType</nowiki>|Parameters=
<span style="color:#000000;"><strong>bool Test HasGetter HasSetter</strong> - Get/Set include those marked as test</span></li>
+
{{CGscriptParameters_Template|Type=int|Name=<nowiki>secondaryQuestionnaireResourceId</nowiki>|Description=<nowiki>Which secondary questionnaire</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>primaryQuestionnaireMapping</nowiki>|Description=<nowiki>Which question to map to. Empty maps to userId. Empty string maps to QasId</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>secondaryQuestionnaireMapping</nowiki>|Description=<nowiki>Which question to map to. Empty maps to userId. Empty string maps to QasId</nowiki>}}
<li style="color:#000000;">
+
|Description=<nowiki>Change the way secondary questionnaires are joined with the primary, default is empty,empty (userId to userId)</nowiki>}}
<span style="color:#000000;"><strong>number UpdateFrequence HasGetter HasSetter</strong> - Get/Set Update Frequence in minutes</span></li>
+
{{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Inherited=object|Description=<nowiki>The string representation of the object.</nowiki>}}
<li style="color:#000000;">
+
|Properties=
<span style="color:#000000;"><strong>string ObjectTypeName HasGetter</strong>&nbsp; - The name of the type of object</span></li>
+
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>AutoUpdate</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set Auto Update</nowiki>}}
<li style="color:#000000;">
+
{{CGscriptProperties_Template|ReturnType=AxisSet|Name=<nowiki>AxisSet</nowiki>|HasGetter=1|Description=<nowiki>Get info on axis in the dcs</nowiki>}}
<span style="color:#000000;"><strong>TypeInformation TypeInformation HasGetter</strong>&nbsp; - Get information about this class</span></li>
+
{{CGscriptProperties_Template|ReturnType=object|Name=<nowiki>BuildUsingWorkflowScriptParameter</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set parameter that script gets as first parameter</nowiki>}}
</ul>
+
{{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>BuildUsingWorkflowScriptResourceId</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set resource id of script to use for building full custom dcs</nowiki>}}
<p>
+
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>BuildWithWeight</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set if the DataCache should be built using weights</nowiki>}}
&nbsp;</p>
+
{{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>CachedRecords</nowiki>|HasGetter=1|Description=<nowiki>How many records does the DataCache currently hold</nowiki>}}
<p>
+
{{CGscriptProperties_Template|ReturnType=array|Name=<nowiki>ColumnNames</nowiki>|HasGetter=1|Description=<nowiki>List of Column names</nowiki>}}
<span style="color:#a52a2a;"><strong>Examples</strong></span></p>
+
{{CGscriptProperties_Template|ReturnType=array|Name=<nowiki>Columns</nowiki>|HasGetter=1|Description=<nowiki>List of Column objects</nowiki>}}
<p>
+
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>Completed</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set include completed</nowiki>}}
<span style="color:#a52a2a;"><strong>Ex1:</strong></span></p>
+
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>Deleted</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set include deleted</nowiki>}}
<p>
+
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>Description</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set description of the DataCache</nowiki>}}
DCS_use(37244952);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#006400;"> //&nbsp; set DCS context</span></p>
+
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>Disabled</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set include disabled</nowiki>}}
<p>
+
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>InterviewFailed</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set include marked as interview failed</nowiki>}}
string e1 = &quot;count() where S_Age == [1] &amp;&amp; M_Travel == [1,2];&quot;;</p>
+
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>InterviewSucceeded</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set include marked as interview succeeded</nowiki>}}
<p>
+
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>IsOutOfDate</nowiki>|HasGetter=1|Description=<nowiki>Does the DataCache need to be rebuilt to have the correct content</nowiki>}}
Dictionary d =</p>
+
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>Language</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set the iso code used in building the items that depend on a specific language. If empty then use default language.</nowiki>}}
<p>
+
{{CGscriptProperties_Template|ReturnType=DateTime|Name=<nowiki>LastUpdated</nowiki>|HasGetter=1|Description=<nowiki>Time of the last rebuild</nowiki>}}
{</p>
+
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>Name</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Name of the DataCache resource</nowiki>}}
<p>
+
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>Normal</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set include normal</nowiki>}}
&nbsp;&nbsp; &quot;exp1&quot;: &quot;count() where S_Age == [1] &amp;&amp; M_Travel == [1,2];&quot;,</p>
+
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>NotStarted</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set include those not yet started</nowiki>}}
<p>
+
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>ObjectTypeName</nowiki>|HasGetter=1|Description=<nowiki>The name of the type of object.</nowiki>}}
&nbsp;&nbsp; &quot;exp2&quot;: &quot;count() where S_Age == [2] &amp;&amp; M_Travel == [1];&quot;</p>
+
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>OutsideTarget</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set include those marked outside target</nowiki>}}
<p>
+
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>PartialRebuild</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set if dcs should only update QAS changed since last build</nowiki>}}
};</p>
+
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>Partly</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set include partly completed</nowiki>}}
<p>
+
{{CGscriptProperties_Template|ReturnType=ProfilingResult|Name=<nowiki>ProfileFromLastEval</nowiki>|HasGetter=1|Description=<nowiki>Get the profile result from the last run of EvalWhere.</nowiki>}}
print(DCS_evaluateWhereExpression(e1));&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#006400;">//&nbsp; 68</span></p>
+
{{CGscriptProperties_Template|ReturnType=array|Name=<nowiki>QuestionnaireIds</nowiki>|HasGetter=1|Description=<nowiki>List of the questionnaires used in the DataCache</nowiki>}}
<p>
+
{{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>QuestionnaireTemplateId</nowiki>|HasGetter=1|Description=<nowiki>The resource id of the questionnaire template used in the DataCache</nowiki>}}
DataCacheSpecification dcs = new DataCacheSpecification();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006400;">//&nbsp; Represent a DCS which is used as current DCS context</span></p>
+
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>QuotaFull</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set include those with full quota</nowiki>}}
<p>
+
{{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>ResourceId</nowiki>|HasGetter=1|Description=<nowiki>The Id of the DataCache</nowiki>}}
print(dcs.EvalWhere(e1));&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; <span style="color:#006400;">//&nbsp; 68</span></p>
+
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>Test</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set include those marked as test</nowiki>}}
<p>
+
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Inherited=object|Description=<nowiki>Get information about this class.</nowiki>}}
print(dcs.EvalWhere(d));&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#006400;">&nbsp;//&nbsp; {&quot;exp1&quot;: 68, &quot;exp2&quot;: 46}</span></p>
+
{{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>UpdateFrequence</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set Update Frequence in minutes</nowiki>}}
<p>
+
{{CGscriptProperties_Template|ReturnType=Array of objects|Name=<nowiki>Weights</nowiki>|HasGetter=1|Description=<nowiki>Get list of existing weights.</nowiki>}}
&nbsp;</p>
+
|StaticMethods=
<p>
+
{{CGscriptMethods_Template|ReturnType=Array of DataCacheSpecification|Name=<nowiki>DataCacheSpecification_getByParent</nowiki>|Parameters=
<span style="color:#a52a2a;"><strong>Ex2:</strong></span></p>
+
{{CGscriptParameters_Template|Type=int|Name=<nowiki>parentResourceId</nowiki>|Description=<nowiki>Resource id of the parent to fetch all children dcs for</nowiki>}}
<p>
+
|Description=<nowiki>Get all children DCS</nowiki>}}
string e1 = &quot;count() where S_Age == [1] &amp;&amp; M_Travel == [1,2];&quot;;</p>
+
}}
<p>
 
Dictionary d =</p>
 
<p>
 
{</p>
 
<p>
 
&nbsp;&nbsp; &quot;exp1&quot;: &quot;count() where S_Age == [1] &amp;&amp; M_Travel == [1,2];&quot;,</p>
 
<p>
 
&nbsp;&nbsp; &quot;exp2&quot;: &quot;count() where S_Age == [2] &amp;&amp; M_Travel == [1];&quot;</p>
 
<p>
 
};</p>
 
<p>
 
DataCacheSpecification dcs = new DataCacheSpecification(37244952);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#006400;">//&nbsp; Represents a DCS which has Resource Id: 37244952</span></p>
 
<p>
 
print(dcs.EvalWhere(e1));&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#006400;"> //&nbsp; 68</span></p>
 
<p>
 
print(dcs.EvalWhere(d));&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#006400;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp; {&quot;exp1&quot;: 68, &quot;exp2&quot;: 46}</span></p>
 
<p>
 
dcs.MakeContext();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#006400;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; or you can use DCS_use(RID) instead</span></p>
 
<p>
 
print(DCS_evaluateWhereExpression(e1));&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#006400;"><span style="font-size: 10px;">&nbsp; //&nbsp; without the previous statement (dcs.MakeContext();), you will get error at this line because there is no DCS context is set, so you can not use DCS_evaluateWhereExpression(e1)</span></span></p>
 
<p>
 
dcs.Partly = false;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#006400;"> //&nbsp; Not include the partly completed QASs</span></p>
 
<p>
 
dcs.NotStarted = false;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#006400;">&nbsp; //&nbsp; Not include the not started QASs</span></p>
 
<p>
 
dcs.Save();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#006400;">&nbsp; //&nbsp; Must save to make the above statements applied on DCS, but this statement does not REBUILD the DCS</span></p>
 
<p>
 
&nbsp;</p>
 
  
 +
=== '''Examples''' ===
  
[[Category:Data_Types_Literals_and_Variables]]
+
'''Ex1:'''
 +
 
 +
<source lang="javascript">
 +
DCS_use(37244952); // set DCS context
 +
string e1 = "count() where S_Age == [1] && M_Travel == [1,2];";
 +
Dictionary d =
 +
{
 +
"exp1": "count() where S_Age == [1] && M_Travel == [1,2];",
 +
"exp2": "count() where S_Age == [2] && M_Travel == [1];"
 +
};
 +
print(DCS_evaluateWhereExpression(e1)); // 68
 +
DataCacheSpecification dcs = new DataCacheSpecification(); // Represent a DCS which is used as current DCS context
 +
print(dcs.EvalWhere(e1)); // 68
 +
print(dcs.EvalWhere(d)); // {"exp1": 68, "exp2": 46}</source>
 +
 
 +
<br />
 +
'''Ex2:'''
 +
 
 +
<source lang="javascript">
 +
string e1 = "count() where S_Age == [1] && M_Travel == [1,2];";
 +
Dictionary d =
 +
{
 +
"exp1": "count() where S_Age == [1] && M_Travel == [1,2];",
 +
"exp2": "count() where S_Age == [2] && M_Travel == [1];"
 +
};
 +
DataCacheSpecification dcs = new DataCacheSpecification(37244952); // Represents a DCS which has Resource Id: 37244952
 +
print(dcs.EvalWhere(e1)); // 68
 +
print(dcs.EvalWhere(d)); // {"exp1": 68, "exp2": 46}
 +
dcs.MakeContext(); // or you can use DCS_use(RID) instead
 +
print(DCS_evaluateWhereExpression(e1)); // without the previous statement (dcs.MakeContext();), you will get error at this line because there is no DCS context is set, so you can not use DCS_evaluateWhereExpression(e1)
 +
dcs.Partly = false; // Not include the partly completed QASs
 +
dcs.NotStarted = false; // Not include the not started QASs
 +
dcs.Save(); // Must save to make the above statements applied on DCS, but this statement does not REBUILD the DCS
 +
</source>
 +
 
 +
<br />
 +
'''Ex 3:'''
 +
 
 +
<source lang="javascript">
 +
ProfilingResult pr;
 +
DataCacheSpecification dcs = new DataCacheSpecification(12006923);
 +
pr = dcs.ProfileFromLastEval;
 +
pr.EnableProfiling = true;
 +
dcs.EvalWhere({
 +
"ex1": "count() where true"
 +
});
 +
 
 +
print(pr.CompileTime); // 0.1694
 +
print(pr.CountResult); // {"5": {"2": 1}, "9": {"4": 1}}
 +
print(pr.DependencyGraphTime); // 0
 +
print(pr.TimeResult); // {"10": {"-1": 0.0158, "4": 0.0158}, "11": {"-1": 0.0021, "4": 0.0021}, "5": {"-1": 1.1024, "2": 1.1024}, "9": {"-1": 0.0063, "4": 0.0063}}
 +
print(pr.WhereExpTime); // 0
 +
</source>
 +
 
 +
<br />
 +
'''Ex 4:'''
 +
 
 +
<source lang="javascript">
 +
DataCacheSpecification dcs = new DataCacheSpecification(15517146);
 +
 
 +
array questionColumns = dcs.CreateAllColumnsForQuestion("Q1",0); //Create new column(s) for a question and use primary questionnaire
 +
 
 +
for(number i= 0; i < questionColumns.Count; i++){
 +
questionColumns[i].Save(); //or method .Delete() in case removing column from dcs
 +
}
 +
dcs.Save(); //Must save to make the above statements applied on DCS, but this statement does not REBUILD the DCS
 +
print(dcs.ColumnNames);
 +
 
 +
</source>
 +
 
 +
<br />
 +
'''Ex 5:'''
 +
 
 +
<source lang="javascript">
 +
DataCacheSpecification dcs = new DataCacheSpecification(15517146);
 +
 
 +
array questionColumns = dcs.CreateAllColumnsForAllQuestions(15517148); //Create ALL columns for ALL questions.Set to 0 to use primary questionnaire
 +
 
 +
for(number i= 0; i < questionColumns.Count; i++){
 +
questionColumns[i].Save();
 +
}
 +
dcs.Save(); //Must save to make the above statements applied on DCS, but this statement does not REBUILD the DCS
 +
print(dcs.ColumnNames);
 +
</source>
 +
 
 +
<br />
 +
'''Ex 6:'''
 +
 
 +
<source lang="javascript">
 +
DataCacheSpecification dcs = new DataCacheSpecification(15558382);
 +
dcs.AddQuestionnaire(15558383);
 +
dcs.Save();
 +
</source>
 +
'''Ex 7:''' Using freeTextFilters on EvalWhere
 +
 
 +
<source lang="javascript">
 +
DataCacheSpecification dcs = new DataCacheSpecification(15557696);
 +
Dictionary d ={
 +
"exp": "selectColumn(Id) where true;"
 +
};
 +
string freeTextFilters  = "UserId: [39149 TO 47878]";
 +
dcs.EvalWhere(d,"","",freeTextFilters);
 +
</source>
 +
'''Ex 8:''' CreateAllColumnsForQuestions
 +
<source lang="javascript">
 +
//*****Example for using CreateAllColumnsForQuestions*****//
 +
//Constructor a DCS
 +
number DCSRId = 15572568;
 +
DataCacheSpecification dcs = new DataCacheSpecification(DCSRId);
 +
//Add columns into the DCS
 +
number qnaireRId = 15572331;// any qnaire that you want to add columns to the above DCS 
 +
array questionsLabel = {"District", "Age"};
 +
Dictionary d = dcs.CreateAllColumnsForQuestions(questionsLabel, qnaireRId);//{"Age": {QcsQuestionColumn}, "District": {QcsQuestionColumn}}
 +
array arrayQcsColumn = d.Values;//{{QcsQuestionColumn},{QcsQuestionColumn}}
 +
 
 +
for(number i=0;i<arrayQcsColumn.Count; i++)
 +
{
 +
array QcsColumn = arrayQcsColumn[i];//{QcsQuestionColumn}
 +
for(number j=0; j<QcsColumn.Count; j++)
 +
{
 +
QcsQuestionColumn col = QcsColumn[j];
 +
col.Save();
 +
}
 +
}
 +
//Save DCS
 +
dcs.Save();
 +
</source>
 +
'''Ex 9:''' Set/GetSecondaryQuestionnaireJoinType
 +
<source lang="javascript">
 +
//*****Example for using Set/GetSecondaryQuestionnaireJoinType*****//
 +
 
 +
//case name(question type text), name (question type number)
 +
DCS_use(15567484);
 +
DataCacheSpecification dcs = new DataCacheSpecification();
 +
string primaryQnaireMapping = "CompanyNo_Text";
 +
string secondaryQnaireMapping = "CompanyNo";
 +
dcs.SetSecondaryQuestionnaireJoinType(15567469,primaryQnaireMapping,secondaryQnaireMapping);
 +
dcs.Save();
 +
dcs.GetSecondaryQuestionnaireJoinType(15567469);//{CompanyNo_Text,CompanyNo}
 +
DCS_rebuild();
 +
 
 +
//case null, name: user id in primary is same as question in secondary
 +
DCS_use(15567484);
 +
DataCacheSpecification dcs = new DataCacheSpecification();
 +
string primaryQnaireMapping = empty;
 +
string secondaryQnaireMapping = "userId_A";
 +
dcs.SetSecondaryQuestionnaireJoinType(15567469,primaryQnaireMapping,secondaryQnaireMapping);
 +
dcs.Save();
 +
DCS_rebuild();
 +
dcs.GetSecondaryQuestionnaireJoinType(15567469);//{Empty,userId_A}
 +
</source>
 +
 
 +
 
 +
[[Category:Classes]]

Latest revision as of 09:49, 20 November 2023

DataCacheSpecification



Represents a DataCache specification.

Parent class

Inherits from object

Constructors

  • () - Instanciate an existing instance using the current context datacache
  • (int ResourceId "Resource Id of the DataCache") - Instanciate an existing instance using the resource id of a datacache
  • (string ResourceName "Resource name of the new DataCache", array Questionnaire Ids "List of Questionnaires to use in the creation. Must all belong to same template") - Create a new datacache using quick setup

Methods

  • Empty AddFilter(string filterQuestionLabel "Question to apply filter to. If empty, then clear current filters", string filterValue "Value of the filter") - Add a filter to the DataCache
  • bool AddQuestionnaire(int questionnaireResourceId "Questionnaire to add") - Add another questionnaire to the datacache. Return false if already added
  • Empty ClearFilter() - Remove all filters from the DataCache
  • Empty ClearSecondaryQuestionnaireJoinType() - Delete all the secondary questionnaires which are joined with the primary
  • array CreateAllColumnsForAllQuestions(int questionnaireResourceId "Set the associated questionnaire. Set to 0 to use primary questionnaire") - Find and create all column for all questions. They still need to be saved individually to be added.
  • array CreateAllColumnsForQuestion(string question "QuestionLabel for the question you want all the dcs columns for", int questionnaireResourceId "Set the associated questionnaire. Set to 0 to use primary questionnaire") - Find and create all column for a given question. They still need to be saved individually to be added.
  • Dictionary CreateAllColumnsForQuestions(array questions "QuestionLabels for the questions you want all the dcs columns for", int questionnaireResourceId "Set the associated questionnaire. Set to 0 to use primary questionnaire") - Find and create all column for a given question. They still need to be saved individually to be added.
  • bool DeleteSecondaryQuestionnaireJoinType(int secondaryQuestionnaireResourceId "Which secondary questionnaire") - Delete the secondary questionnaire which is joined with the primary
  • object EvalWhere(string whereExpression "The expression to execute. It must contain 'where' and NOT start with a equal sign, and have 1 and only one semicolon in it") - Evaluate a single where expression up against the current DataCache
  • Dictionary EvalWhere(Dictionary whereExpressions "The expressions to execute. They must contain 'where' and MAY start with a equal sign, and have 1 and only one semicolon in it") - OBSOLETE, use EvalWhereExps! Evaluate a number of where expressions up against the current DataCache. If there are 2 or more expressions, the result is cached. Context weight and filters are ignored.
  • Dictionary EvalWhere(Dictionary whereExpressions "The expressions to execute. They must contain 'where' and MAY start with a equal sign, and have 1 and only one semicolon in it", string weight "Column name of the weight to use in filter") - OBSOLETE, use EvalWhereExps! Evaluate a number of where expressions up against the current DataCache using a weight. If there are 2 or more expressions, the result is cached. Context weight and filters are ignored.
  • Dictionary EvalWhere(Dictionary whereExpressions "The expressions to execute. They must contain 'where' and MAY start with a equal sign, and have 1 and only one semicolon in it", string weight "Column name of the weight to use in filter", string filters "Extra filters that apply to all where expressions") - OBSOLETE, use EvalWhereExps! Evaluate a number of where expressions up against the current DataCache using a weight. If there are 2 or more expressions, the result is cached. Context weight and filters are ignored.
  • Dictionary EvalWhere(Dictionary whereExpressions "The expressions to execute. They must contain 'where' and MAY start with a equal sign, and have 1 and only one semicolon in it", string weight "Column name of the weight to use in filter", string filters "Extra filters that apply to all where expressions", string freeTextFilters "Extra free text search filters that apply to all where expressions") - OBSOLETE, use EvalWhereExps! Evaluate a number of where expressions up against the current DataCache using a weight. If there are 2 or more expressions, the result is cached. Context weight and filters are ignored.
  • Dictionary EvalWhereExps(Dictionary whereExpressions "The expressions to execute. They must contain 'where' and MAY start with a equal sign, and have 1 and only one semicolon in it") - Evaluate a number of where expressions up against the current DataCache. If there are 2 or more expressions, the result is cached. Context weight and filters are ignored.
  • Dictionary EvalWhereExps(Dictionary whereExpressions "The expressions to execute. They must contain 'where' and MAY start with a equal sign, and have 1 and only one semicolon in it", string weight "Column name of the weight to use in filter") - Evaluate a number of where expressions up against the current DataCache using a weight. If there are 2 or more expressions, the result is cached. Context weight and filters are ignored.
  • Dictionary EvalWhereExps(Dictionary whereExpressions "The expressions to execute. They must contain 'where' and MAY start with a equal sign, and have 1 and only one semicolon in it", string weight "Column name of the weight to use in filter", string filters "Extra filters that apply to all where expressions") - Evaluate a number of where expressions up against the current DataCache using a weight. If there are 2 or more expressions, the result is cached. Context weight and filters are ignored.
  • Dictionary EvalWhereExps(Dictionary whereExpressions "The expressions to execute. They must contain 'where' and MAY start with a equal sign, and have 1 and only one semicolon in it", string weight "Column name of the weight to use in filter", string filters "Extra filters that apply to all where expressions", string freeTextFilters "Extra free text search filters that apply to all where expressions") - Evaluate a number of where expressions up against the current DataCache using a weight. If there are 2 or more expressions, the result is cached. Context weight and filters are ignored.
  • array GetAllSecondaryQuestionnaireJoinType() - Get all the secondary questionnaires that are joined with the primary
  • array GetSecondaryQuestionnaireJoinType(int secondaryQuestionnaireResourceId "Which secondary questionnaire") - Get the way secondary questionnaires are joined with the primary, default is empty,empty (userId to userId)
  • Empty MakeContext() - Make the current DataCache the context DataCache
  • Empty Rebuild(bool forceRebuild "Rebuild even if dcs was already built and unchanged", bool waitForCompletion "Do not return until the rebuild is complete", int minAgeInMinutes "Rebuild only if last build ended more than this amount of minutes ago, 0 to disable check. This supersedes forceRebuild", bool forceFull "Force a complete rebuild, even if dcs is configured for partial rebuilds", object extraParameter "If the dcs to build is built from a script it will get this as the 5th parameter") - Rebuild the dcs. Notice this will commit the current transaction
  • Empty Rebuild(bool forceRebuild "Rebuild even if dcs was already built and unchanged", bool waitForCompletion "Do not return until the rebuild is complete", int minAgeInMinutes "Rebuild only if last build ended more than this amount of minutes ago, 0 to disable check. This supersedes forceRebuild", bool forceFull "Force a complete rebuild, even if dcs is configured for partial rebuilds") - Rebuild the dcs. Notice this will commit the current transaction
  • Empty Rebuild(bool forceRebuild "Rebuild even if dcs was already built and unchanged", bool waitForCompletion "Do not return until the rebuild is complete", int minAgeInMinutes "Rebuild only if last build ended more than this amount of minutes ago, 0 to disable check. This supersedes forceRebuild") - Rebuild the dcs. Notice this will commit the current transaction
  • Empty RemoveFilter(string filterQuestionLabel "Question to apply filter to. If empty, then clear current filters") - Remove a filter from the DataCache
  • Empty Reset() - Reset to initial quick setup
  • Empty Save() - Save the DataCache
  • Empty SetSecondaryQuestionnaireJoinType(int secondaryQuestionnaireResourceId "Which secondary questionnaire", string primaryQuestionnaireMapping "Which question to map to. Empty maps to userId. Empty string maps to QasId", string secondaryQuestionnaireMapping "Which question to map to. Empty maps to userId. Empty string maps to QasId") - Change the way secondary questionnaires are joined with the primary, default is empty,empty (userId to userId)
  • (From object) string ToString() - The string representation of the object.

Properties

  • bool AutoUpdate { get; set; } - Get/Set Auto Update
  • AxisSet AxisSet { get; } - Get info on axis in the dcs
  • object BuildUsingWorkflowScriptParameter { get; set; } - Get/Set parameter that script gets as first parameter
  • int BuildUsingWorkflowScriptResourceId { get; set; } - Get/Set resource id of script to use for building full custom dcs
  • bool BuildWithWeight { get; set; } - Get/Set if the DataCache should be built using weights
  • int CachedRecords { get; } - How many records does the DataCache currently hold
  • array ColumnNames { get; } - List of Column names
  • array Columns { get; } - List of Column objects
  • bool Completed { get; set; } - Get/Set include completed
  • bool Deleted { get; set; } - Get/Set include deleted
  • string Description { get; set; } - Get/Set description of the DataCache
  • bool Disabled { get; set; } - Get/Set include disabled
  • bool InterviewFailed { get; set; } - Get/Set include marked as interview failed
  • bool InterviewSucceeded { get; set; } - Get/Set include marked as interview succeeded
  • bool IsOutOfDate { get; } - Does the DataCache need to be rebuilt to have the correct content
  • string Language { get; set; } - Get/Set the iso code used in building the items that depend on a specific language. If empty then use default language.
  • DateTime LastUpdated { get; } - Time of the last rebuild
  • string Name { get; set; } - Name of the DataCache resource
  • bool Normal { get; set; } - Get/Set include normal
  • bool NotStarted { get; set; } - Get/Set include those not yet started
  • string ObjectTypeName { get; } - The name of the type of object.
  • bool OutsideTarget { get; set; } - Get/Set include those marked outside target
  • bool PartialRebuild { get; set; } - Get/Set if dcs should only update QAS changed since last build
  • bool Partly { get; set; } - Get/Set include partly completed
  • ProfilingResult ProfileFromLastEval { get; } - Get the profile result from the last run of EvalWhere.
  • array QuestionnaireIds { get; } - List of the questionnaires used in the DataCache
  • int QuestionnaireTemplateId { get; } - The resource id of the questionnaire template used in the DataCache
  • bool QuotaFull { get; set; } - Get/Set include those with full quota
  • int ResourceId { get; } - The Id of the DataCache
  • bool Test { get; set; } - Get/Set include those marked as test
  • (From object) TypeInformation TypeInformation { get; } - Get information about this class.
  • int UpdateFrequence { get; set; } - Get/Set Update Frequence in minutes
  • Array of objects Weights { get; } - Get list of existing weights.

Static Methods

  • Array of DataCacheSpecification DataCacheSpecification_getByParent(int parentResourceId "Resource id of the parent to fetch all children dcs for") - Get all children DCS

Examples

Ex1:

DCS_use(37244952); // set DCS context
string e1 = "count() where S_Age == [1] && M_Travel == [1,2];";
Dictionary d =
{
 "exp1": "count() where S_Age == [1] && M_Travel == [1,2];",
 "exp2": "count() where S_Age == [2] && M_Travel == [1];"
};
print(DCS_evaluateWhereExpression(e1)); // 68
DataCacheSpecification dcs = new DataCacheSpecification(); // Represent a DCS which is used as current DCS context
print(dcs.EvalWhere(e1)); // 68
print(dcs.EvalWhere(d)); // {"exp1": 68, "exp2": 46}


Ex2:

string e1 = "count() where S_Age == [1] && M_Travel == [1,2];";
Dictionary d =
{
 "exp1": "count() where S_Age == [1] && M_Travel == [1,2];",
 "exp2": "count() where S_Age == [2] && M_Travel == [1];"
};
DataCacheSpecification dcs = new DataCacheSpecification(37244952); // Represents a DCS which has Resource Id: 37244952
print(dcs.EvalWhere(e1)); // 68
print(dcs.EvalWhere(d)); // {"exp1": 68, "exp2": 46}
dcs.MakeContext(); // or you can use DCS_use(RID) instead
print(DCS_evaluateWhereExpression(e1)); // without the previous statement (dcs.MakeContext();), you will get error at this line because there is no DCS context is set, so you can not use DCS_evaluateWhereExpression(e1)
dcs.Partly = false; // Not include the partly completed QASs
dcs.NotStarted = false; // Not include the not started QASs
dcs.Save(); // Must save to make the above statements applied on DCS, but this statement does not REBUILD the DCS


Ex 3:

ProfilingResult pr;
DataCacheSpecification dcs = new DataCacheSpecification(12006923); 
pr = dcs.ProfileFromLastEval;
pr.EnableProfiling = true;
dcs.EvalWhere({
 "ex1": "count() where true"
});

print(pr.CompileTime); // 0.1694
print(pr.CountResult); // {"5": {"2": 1}, "9": {"4": 1}} 
print(pr.DependencyGraphTime); // 0
print(pr.TimeResult); // {"10": {"-1": 0.0158, "4": 0.0158}, "11": {"-1": 0.0021, "4": 0.0021}, "5": {"-1": 1.1024, "2": 1.1024}, "9": {"-1": 0.0063, "4": 0.0063}}
print(pr.WhereExpTime); // 0


Ex 4:

DataCacheSpecification dcs = new DataCacheSpecification(15517146);

array questionColumns = dcs.CreateAllColumnsForQuestion("Q1",0); //Create new column(s) for a question and use primary questionnaire 

for(number i= 0; i < questionColumns.Count; i++){
 questionColumns[i].Save(); //or method .Delete() in case removing column from dcs
}
dcs.Save(); //Must save to make the above statements applied on DCS, but this statement does not REBUILD the DCS
print(dcs.ColumnNames);


Ex 5:

DataCacheSpecification dcs = new DataCacheSpecification(15517146);

array questionColumns = dcs.CreateAllColumnsForAllQuestions(15517148); //Create ALL columns for ALL questions.Set to 0 to use primary questionnaire

for(number i= 0; i < questionColumns.Count; i++){
 questionColumns[i].Save();
}
dcs.Save(); //Must save to make the above statements applied on DCS, but this statement does not REBUILD the DCS
print(dcs.ColumnNames);


Ex 6:

DataCacheSpecification dcs = new DataCacheSpecification(15558382);
dcs.AddQuestionnaire(15558383);
dcs.Save();

Ex 7: Using freeTextFilters on EvalWhere

DataCacheSpecification dcs = new DataCacheSpecification(15557696);
Dictionary d ={
	"exp": "selectColumn(Id) where true;"
};
string freeTextFilters  = "UserId: [39149 TO 47878]";
dcs.EvalWhere(d,"","",freeTextFilters);

Ex 8: CreateAllColumnsForQuestions

//*****Example for using CreateAllColumnsForQuestions*****//
//Constructor a DCS
number DCSRId = 15572568;
DataCacheSpecification dcs = new DataCacheSpecification(DCSRId);
//Add columns into the DCS
number qnaireRId = 15572331;// any qnaire that you want to add columns to the above DCS  
array questionsLabel = {"District", "Age"};
Dictionary d = dcs.CreateAllColumnsForQuestions(questionsLabel, qnaireRId);//{"Age": {QcsQuestionColumn}, "District": {QcsQuestionColumn}}
array arrayQcsColumn = d.Values;//{{QcsQuestionColumn},{QcsQuestionColumn}}

for(number i=0;i<arrayQcsColumn.Count; i++)
{
	array QcsColumn = arrayQcsColumn[i];//{QcsQuestionColumn}
	for(number j=0; j<QcsColumn.Count; j++)
	{
		QcsQuestionColumn col = QcsColumn[j];
		col.Save();
	}
}
//Save DCS
dcs.Save();

Ex 9: Set/GetSecondaryQuestionnaireJoinType

//*****Example for using Set/GetSecondaryQuestionnaireJoinType*****//

//case name(question type text), name (question type number)
DCS_use(15567484);
DataCacheSpecification dcs = new DataCacheSpecification();
string primaryQnaireMapping = "CompanyNo_Text";
string secondaryQnaireMapping = "CompanyNo";
dcs.SetSecondaryQuestionnaireJoinType(15567469,primaryQnaireMapping,secondaryQnaireMapping);
dcs.Save();
dcs.GetSecondaryQuestionnaireJoinType(15567469);//{CompanyNo_Text,CompanyNo}
DCS_rebuild();

//case null, name: user id in primary is same as question in secondary
DCS_use(15567484);
DataCacheSpecification dcs = new DataCacheSpecification();
string primaryQnaireMapping = empty;
string secondaryQnaireMapping = "userId_A";
dcs.SetSecondaryQuestionnaireJoinType(15567469,primaryQnaireMapping,secondaryQnaireMapping);
dcs.Save();
DCS_rebuild();
dcs.GetSecondaryQuestionnaireJoinType(15567469);//{Empty,userId_A}