Difference between revisions of "WhereExpFragment class"

From Catglobe Wiki
Jump to: navigation, search
(Created page with "{{CGscriptClass_Template |Name=<nowiki>WhereExpFragment</nowiki> |Description=<nowiki>Represents a data cache specification column with user data.</nowiki> |InheritsFrom=objec...")
 
Line 24: Line 24:
 
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Inherited=object|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>}}
 
}}
 
}}
 +
=== <span style="color:#DF8621">'''Examples'''</span> ===
 +
 +
<source lang="javascript">
 +
 +
DataCacheSpecification dcs = new DataCacheSpecification (dcsRId);
 +
Dictionary exp = {
 +
"Total": new WhereExpFragment (WHEREEXPFRAGMENT_ADD, new WhereExpFragment ("count() where Gender==1"), new WhereExpFragment ("count() where Gender==2")),
 +
"Male": new WhereExpFragment ("count()", new WhereExpFragment ("Gender==1")),
 +
"Female": new WhereExpFragment ("count() where Gender==2")};
 +
dcs.EvalWhereExps(exp);
 +
</source>

Revision as of 10:20, 22 September 2020

WhereExpFragment



Represents a data cache specification column with user data.

Parent class

Inherits from object

Constructors

  • (string expression "Expression for the fragment.") - Create a fragment with the given expression. This is an expensive operation when called many times
  • (string selector "Selector expression of the where expression, e.g. "count()".", WhereExpFragment whereExp "Left hand side of the operation.") - Create a fragment as a complete where expression.
  • (WhereExpFragment fragment "Fragment to replace values in.", Dictionary replacement "Look for keys and replace with the constants.") - Create a new fragment where the given values has been replaced, e.g. col > DATES + {"DATES":#2020...#} => col > #2020...#.
  • (int operation "See WHEREEXPFRAGMENT_xxx, e.g. WHEREEXPFRAGMENT_AND.", WhereExpFragment lhs "Left hand side of the operation.", WhereExpFragment rhs "Right hand side of the operation.") - Create a new fragment as an operation between two other fragments.

Methods

  • Empty AddDependency(string key "Key in Dictionary that this expression depends on") - If you access another cell, you need to inform the engine about this, so it can determine which cells to execute in parallel
  • (From object) string ToString() - The string representation of the object.

Properties

  • string ObjectTypeName { get; } - The name of the type of object.
  • (From object) TypeInformation TypeInformation { get; } - Get information about this class.

Examples

DataCacheSpecification dcs = new DataCacheSpecification (dcsRId);
Dictionary exp = {
	"Total": new WhereExpFragment (WHEREEXPFRAGMENT_ADD, new WhereExpFragment ("count() where Gender==1"), new WhereExpFragment ("count() where Gender==2")),
	"Male": new WhereExpFragment ("count()", new WhereExpFragment ("Gender==1")),
	"Female": new WhereExpFragment ("count() where Gender==2")};
dcs.EvalWhereExps(exp);