Difference between revisions of "DataCacheSpecification class"

From Catglobe Wiki
Jump to: navigation, search
Line 1: Line 1:
 
{{CGscriptClass_Template
 
{{CGscriptClass_Template
|Name=DataCacheSpecification
+
|Name=<nowiki>DataCacheSpecification</nowiki>
|Description=Represents a DataCache specification.
+
|Description=<nowiki>Represents a DataCache specification.</nowiki>
 
|Constructors=
 
|Constructors=
{{CGscriptConstructors_Template|Description=Instanciate an existing instance using the current context datacache}}
+
{{CGscriptConstructors_Template|Description=<nowiki>Instanciate an existing instance using the current context datacache</nowiki>}}
 
{{CGscriptConstructors_Template|Parameters=
 
{{CGscriptConstructors_Template|Parameters=
{{CGscriptParameters_Template|Type=int|Name=ResourceId|Description=Resource Id of the DataCache}}
+
{{CGscriptParameters_Template|Type=int|Name=<nowiki>ResourceId</nowiki>|Description=<nowiki>Resource Id of the DataCache</nowiki>}}
|Description=Instanciate an existing instance using the resource id of a datacache}}
+
|Description=<nowiki>Instanciate an existing instance using the resource id of a datacache</nowiki>}}
 
{{CGscriptConstructors_Template|Parameters=
 
{{CGscriptConstructors_Template|Parameters=
{{CGscriptParameters_Template|Type=string|Name=ResourceName|Description=Resource name of the new DataCache|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=Questionnaire Ids|Description=List of Questionnaires to use in the creation. Must all belong to same template}}
+
{{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>}}
|Description=Create a new datacache using quick setup}}
+
|Description=<nowiki>Create a new datacache using quick setup</nowiki>}}
 
|Methods=
 
|Methods=
{{CGscriptMethods_Template|ReturnType=Empty|Name=AddFilter|Parameters=
+
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>AddFilter</nowiki>|Parameters=
{{CGscriptParameters_Template|Type=string|Name=filterQuestionLabel|Description=Question to apply filter to. If empty, then clear current filters|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=filterValue|Description=Value of the filter}}
+
{{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>}}
|Description=Add a filter to the DataCache}}
+
|Description=<nowiki>Add a filter to the DataCache</nowiki>}}
{{CGscriptMethods_Template|ReturnType=array|Name=CreateAllColumnsForAllQuestions|Parameters=
+
{{CGscriptMethods_Template|ReturnType=bool|Name=<nowiki>AddQuestionnaire</nowiki>|Parameters=
{{CGscriptParameters_Template|Type=int|Name=questionnaireResourceId|Description=Set the associated questionnaire. Set to 0 to use primary questionnaire}}
+
{{CGscriptParameters_Template|Type=int|Name=<nowiki>questionnaireResourceId</nowiki>|Description=<nowiki>Questionnaire to add</nowiki>}}
|Description=Find and create all column for all questions. They still need to be saved individually to be added.}}
+
|Description=<nowiki>Add another questionnaire to the datacache. Return false if already added</nowiki>}}
{{CGscriptMethods_Template|ReturnType=array|Name=CreateAllColumnsForQuestion|Parameters=
+
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>CreateAllColumnsForAllQuestions</nowiki>|Parameters=
{{CGscriptParameters_Template|Type=string|Name=question|Description=QuestionLabel for the question you want all the dcs columns for|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=questionnaireResourceId|Description=Set the associated questionnaire. Set to 0 to use primary questionnaire}}
+
{{CGscriptParameters_Template|Type=int|Name=<nowiki>questionnaireResourceId</nowiki>|Description=<nowiki>Set the associated questionnaire. Set to 0 to use primary questionnaire</nowiki>}}
|Description=Find and create all column for a given question. They still need to be saved individually to be added.}}
+
|Description=<nowiki>Find and create all column for all questions. They still need to be saved individually to be added.</nowiki>}}
{{CGscriptMethods_Template|ReturnType=object|Name=EvalWhere|Parameters=
+
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>CreateAllColumnsForQuestion</nowiki>|Parameters=
{{CGscriptParameters_Template|Type=string|Name=whereExpression|Description=The expression to execute. It must contain 'where' and NOT start with a equal sign, and have 1 and only one semicolon in it}}
+
{{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>}}
|Description=Evaluate a single where expression up against the current DataCache}}
+
|Description=<nowiki>Find and create all column for a given question. They still need to be saved individually to be added.</nowiki>}}
{{CGscriptMethods_Template|ReturnType=Dictionary|Name=EvalWhere|Parameters=
+
{{CGscriptMethods_Template|ReturnType=object|Name=<nowiki>EvalWhere</nowiki>|Parameters=
{{CGscriptParameters_Template|Type=Dictionary|Name=whereExpressions|Description=The expressions to execute. They must contain 'where' and MAY start with a equal sign, and have 1 and only one semicolon in it}}
+
{{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>}}
|Description=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.}}
+
|Description=<nowiki>Evaluate a single where expression up against the current DataCache</nowiki>}}
{{CGscriptMethods_Template|ReturnType=Dictionary|Name=EvalWhere|Parameters=
+
{{CGscriptMethods_Template|ReturnType=Dictionary|Name=<nowiki>EvalWhere</nowiki>|Parameters=
{{CGscriptParameters_Template|Type=Dictionary|Name=whereExpressions|Description=The expressions to execute. They must contain 'where' and MAY start with a equal sign, and have 1 and only one semicolon in it|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=weight|Description=Column name of the weight to use in filter}}
+
{{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>}}
|Description=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.}}
+
|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>}}
{{CGscriptMethods_Template|ReturnType=Dictionary|Name=EvalWhere|Parameters=
+
{{CGscriptMethods_Template|ReturnType=Dictionary|Name=<nowiki>EvalWhere</nowiki>|Parameters=
{{CGscriptParameters_Template|Type=Dictionary|Name=whereExpressions|Description=The expressions to execute. They must contain 'where' and MAY start with a equal sign, and have 1 and only one semicolon in it|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=weight|Description=Column name of the weight to use in filter|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=filters|Description=Extra filters that apply to all where expressions}}
+
{{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>}}
|Description=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.}}
+
|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>}}
{{CGscriptMethods_Template|ReturnType=Empty|Name=MakeContext|Description=Make the current DataCache the context DataCache}}
+
{{CGscriptMethods_Template|ReturnType=Dictionary|Name=<nowiki>EvalWhere</nowiki>|Parameters=
{{CGscriptMethods_Template|ReturnType=Empty|Name=Reset|Description=Reset to initial quick setup}}
+
{{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>}}
{{CGscriptMethods_Template|ReturnType=Empty|Name=Save|Description=Save the DataCache}}
+
|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>}}
{{CGscriptMethods_Template|ReturnType=string|Name=ToString|Description=The string representation of the object.}}
+
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>MakeContext</nowiki>|Description=<nowiki>Make the current DataCache the context DataCache</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>Reset</nowiki>|Description=<nowiki>Reset to initial quick setup</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>Save</nowiki>|Description=<nowiki>Save the DataCache</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Description=<nowiki>The string representation of the object.</nowiki>}}
 
|Properties=
 
|Properties=
{{CGscriptProperties_Template|ReturnType=bool|Name=AutoUpdate|HasGetter=1|HasSetter=1|Description=Get/Set Auto Update}}
+
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>AutoUpdate</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set Auto Update</nowiki>}}
{{CGscriptProperties_Template|ReturnType=bool|Name=BuildWithWeight|HasGetter=1|HasSetter=1|Description=Get/Set if the DataCache should be built using weights}}
+
{{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>}}
{{CGscriptProperties_Template|ReturnType=int|Name=CachedRecords|HasGetter=1|Description=How many records does the DataCache currently hold}}
+
{{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>CachedRecords</nowiki>|HasGetter=1|Description=<nowiki>How many records does the DataCache currently hold</nowiki>}}
{{CGscriptProperties_Template|ReturnType=array|Name=ColumnNames|HasGetter=1|Description=List of Column names}}
+
{{CGscriptProperties_Template|ReturnType=array|Name=<nowiki>ColumnNames</nowiki>|HasGetter=1|Description=<nowiki>List of Column names</nowiki>}}
{{CGscriptProperties_Template|ReturnType=array|Name=Columns|HasGetter=1|Description=List of Column objects}}
+
{{CGscriptProperties_Template|ReturnType=array|Name=<nowiki>Columns</nowiki>|HasGetter=1|Description=<nowiki>List of Column objects</nowiki>}}
{{CGscriptProperties_Template|ReturnType=bool|Name=Completed|HasGetter=1|HasSetter=1|Description=Get/Set include completed}}
+
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>Completed</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set include completed</nowiki>}}
{{CGscriptProperties_Template|ReturnType=bool|Name=Deleted|HasGetter=1|HasSetter=1|Description=Get/Set include deleted}}
+
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>Deleted</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set include deleted</nowiki>}}
{{CGscriptProperties_Template|ReturnType=string|Name=Description|HasGetter=1|HasSetter=1|Description=Get/Set description of the DataCache}}
+
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>Description</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set description of the DataCache</nowiki>}}
{{CGscriptProperties_Template|ReturnType=bool|Name=Disabled|HasGetter=1|HasSetter=1|Description=Get/Set include disabled}}
+
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>Disabled</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set include disabled</nowiki>}}
{{CGscriptProperties_Template|ReturnType=bool|Name=InterviewFailed|HasGetter=1|HasSetter=1|Description=Get/Set include marked as interview failed}}
+
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>InterviewFailed</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set include marked as interview failed</nowiki>}}
{{CGscriptProperties_Template|ReturnType=bool|Name=InterviewSucceeded|HasGetter=1|HasSetter=1|Description=Get/Set include marked as interview succeeded}}
+
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>InterviewSucceeded</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set include marked as interview succeeded</nowiki>}}
{{CGscriptProperties_Template|ReturnType=bool|Name=IsOutOfDate|HasGetter=1|Description=Does the DataCache need to be rebuilt to have the correct content}}
+
{{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>}}
{{CGscriptProperties_Template|ReturnType=string|Name=Language|HasGetter=1|HasSetter=1|Description=Get/Set the iso code used in building the items that depend on a specific language}}
+
{{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</nowiki>}}
{{CGscriptProperties_Template|ReturnType=DateTime|Name=LastUpdated|HasGetter=1|Description=Time of the last rebuild}}
+
{{CGscriptProperties_Template|ReturnType=DateTime|Name=<nowiki>LastUpdated</nowiki>|HasGetter=1|Description=<nowiki>Time of the last rebuild</nowiki>}}
{{CGscriptProperties_Template|ReturnType=string|Name=Name|HasGetter=1|HasSetter=1|Description=Name of the DataCache resource}}
+
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>Name</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Name of the DataCache resource</nowiki>}}
{{CGscriptProperties_Template|ReturnType=bool|Name=Normal|HasGetter=1|HasSetter=1|Description=Get/Set include normal}}
+
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>Normal</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set include normal</nowiki>}}
{{CGscriptProperties_Template|ReturnType=bool|Name=NotStarted|HasGetter=1|HasSetter=1|Description=Get/Set include those not yet started}}
+
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>NotStarted</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set include those not yet started</nowiki>}}
{{CGscriptProperties_Template|ReturnType=string|Name=ObjectTypeName|HasGetter=1|Description=The name of the type of object.}}
+
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>ObjectTypeName</nowiki>|HasGetter=1|Description=<nowiki>The name of the type of object.</nowiki>}}
{{CGscriptProperties_Template|ReturnType=bool|Name=OutsideTarget|HasGetter=1|HasSetter=1|Description=Get/Set include those marked outside target}}
+
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>OutsideTarget</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set include those marked outside target</nowiki>}}
{{CGscriptProperties_Template|ReturnType=bool|Name=Partly|HasGetter=1|HasSetter=1|Description=Get/Set include partly completed}}
+
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>Partly</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set include partly completed</nowiki>}}
{{CGscriptProperties_Template|ReturnType=ProfilingResult|Name=ProfileFromLastEval|HasGetter=1|Description=Get the profile result from the last run of EvalWhere.}}
+
{{CGscriptProperties_Template|ReturnType=ProfilingResult|Name=<nowiki>ProfileFromLastEval</nowiki>|HasGetter=1|Description=<nowiki>Get the profile result from the last run of EvalWhere.</nowiki>}}
{{CGscriptProperties_Template|ReturnType=array|Name=QuestionnaireIds|HasGetter=1|Description=List of the questionnaires used in the DataCache}}
+
{{CGscriptProperties_Template|ReturnType=array|Name=<nowiki>QuestionnaireIds</nowiki>|HasGetter=1|Description=<nowiki>List of the questionnaires used in the DataCache</nowiki>}}
{{CGscriptProperties_Template|ReturnType=int|Name=QuestionnaireTemplateId|HasGetter=1|Description=The resource id of the questionnaire template used in the DataCache}}
+
{{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>QuestionnaireTemplateId</nowiki>|HasGetter=1|Description=<nowiki>The resource id of the questionnaire template used in the DataCache</nowiki>}}
{{CGscriptProperties_Template|ReturnType=bool|Name=QuotaFull|HasGetter=1|HasSetter=1|Description=Get/Set include those with full quota}}
+
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>QuotaFull</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set include those with full quota</nowiki>}}
{{CGscriptProperties_Template|ReturnType=int|Name=ResourceId|HasGetter=1|Description=The Id of the DataCache}}
+
{{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>ResourceId</nowiki>|HasGetter=1|Description=<nowiki>The Id of the DataCache</nowiki>}}
{{CGscriptProperties_Template|ReturnType=bool|Name=Test|HasGetter=1|HasSetter=1|Description=Get/Set include those marked as test}}
+
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>Test</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set include those marked as test</nowiki>}}
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=TypeInformation|HasGetter=1|Description=Get information about this class.}}
+
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Description=<nowiki>Get information about this class.</nowiki>}}
{{CGscriptProperties_Template|ReturnType=int|Name=UpdateFrequence|HasGetter=1|HasSetter=1|Description=Get/Set Update Frequence in minutes}}
+
{{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>UpdateFrequence</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set Update Frequence in minutes</nowiki>}}
{{CGscriptProperties_Template|ReturnType=Array of objects|Name=Weights|HasGetter=1|Description=Get list of existing weights.}}
+
{{CGscriptProperties_Template|ReturnType=Array of objects|Name=<nowiki>Weights</nowiki>|HasGetter=1|Description=<nowiki>Get list of existing weights.</nowiki>}}
 
}}
 
}}
  
Line 87: Line 90:
 
print(dcs.EvalWhere(d)); // {"exp1": 68, "exp2": 46}</source>
 
print(dcs.EvalWhere(d)); // {"exp1": 68, "exp2": 46}</source>
  
<br/>'''Ex2:'''
+
<br/>
 +
'''Ex2:'''
  
 
<source lang="javascript">
 
<source lang="javascript">
Line 106: Line 110:
 
</source>
 
</source>
  
<br/>'''Ex 3:'''
+
<br/>
 +
'''Ex 3:'''
  
 
<source lang="javascript">
 
<source lang="javascript">
Line 124: Line 129:
 
</source>
 
</source>
  
<br/>'''Ex 4:'''
+
<br/>
 +
'''Ex 4:'''
  
 
<source lang="javascript">
 
<source lang="javascript">
Line 139: Line 145:
 
</source>
 
</source>
  
<br/>'''Ex 5:'''
+
<br/>
 +
'''Ex 5:'''
  
 
<source lang="javascript">
 
<source lang="javascript">

Revision as of 07:45, 14 February 2017

DataCacheSpecification



Represents a DataCache specification.

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
  • 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.
  • 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") - 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") - 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") - 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.
  • Empty MakeContext() - Make the current DataCache the context DataCache
  • Empty Reset() - Reset to initial quick setup
  • Empty Save() - Save the DataCache
  • string ToString() - The string representation of the object.

Properties

  • bool AutoUpdate { get; set; } - Get/Set Auto Update
  • 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
  • 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 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
  • 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.



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);