Difference between revisions of "DCS evaluateWhereExpression"

From Catglobe Wiki
Jump to: navigation, search
(DCS_evaluateWhereExpression)
(Tag: visualeditor)
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
= DCS_evaluateWhereExpression  =
 
[[Category:Data_Cache_Functions]]
 
[[Category:Data_Cache_Functions]]
{{HelpFiles}}
+
__NOTOC__
 +
 
 +
Evaluate a WHERE expression. See also [[DCS evaluateWhereExpressions]] for faster evalution of multiple expressions.
 +
 
 +
This function is an alias to EvalWhere in [[DataCacheSpecification class]].
 +
 
 +
=== Syntax  ===
 +
 
 +
DCS_evaluateWhereExpression(whereExpression)
 +
 
 +
=== Arguments  ===
 +
 
 +
*whereExpression: is string. ex: "selectColumn(Id) where true;"
 +
 
 +
=== Return value  ===
 +
 
 +
Execute the where expression and return an object depending on where expression:
 +
 
 +
{| class="tableintopic" style="border-collapse: collapse; border: 1px solid #010101" width="438" cellpadding="2" border="1"
 +
|- valign="top" align="left"
 +
| style="border: 1px solid #010101" width="216" bgcolor="#C0C0C0" |
 +
'''WhereExpression'''
  
====DCS_evaluateWhereExpression====
+
| style="border: 1px solid #010101" width="222" bgcolor="#C0C0C0" |
 +
'''Return type'''
  
Evaluate a WHERE expression
+
|- valign="top" align="left"
 +
| style="border: 1px solid #010101" width="216" |
 +
average
  
'''Syntax'''
+
| style="border: 1px solid #010101" width="222" |
 +
empty
  
DCS_evaluateWhereExpression(whereExpression)
+
|- valign="top" align="left"
 +
| style="border: 1px solid #010101" width="216" |
 +
count
  
'''Arguments'''
+
| style="border: 1px solid #010101" width="222" |
 +
number
  
* whereExpression: is string
+
|- valign="top" align="left"
 +
| style="border: 1px solid #010101" width="216" |
 +
max
  
'''Return value'''
+
| style="border: 1px solid #010101" width="222" |
 +
number
  
Execute the where expression and return an object depending on where expression:
+
|- valign="top" align="left"
 +
| style="border: 1px solid #010101" width="216" |
 +
median
  
{| class="tableintopic" style="border-collapse: collapse; border: 1px solid #010101" width="438" border="1" cellpadding="2"
+
| style="border: 1px solid #010101" width="222" |  
|- align="left" valign="top"
+
number  
| style="border: 1px solid #010101" width="216" bgcolor="#C0C0C0" |
 
'''WhereExpression'''
 
| style="border: 1px solid #010101" width="222" bgcolor="#C0C0C0" |
 
'''Return type'''
 
|- align="left" valign="top"
 
| style="border: 1px solid #010101" width="216" |
 
average
 
| style="border: 1px solid #010101" width="222" |
 
empty
 
|- align="left" valign="top"
 
| style="border: 1px solid #010101" width="216" |
 
count
 
| style="border: 1px solid #010101" width="222" |
 
number
 
|- align="left" valign="top"
 
| style="border: 1px solid #010101" width="216" |
 
max
 
| style="border: 1px solid #010101" width="222" |
 
number
 
|- align="left" valign="top"
 
| style="border: 1px solid #010101" width="216" |
 
median
 
| style="border: 1px solid #010101" width="222" |
 
number
 
|- align="left" valign="top"
 
| style="border: 1px solid #010101" width="216" |
 
min
 
| style="border: 1px solid #010101" width="222" |
 
number
 
|- align="left" valign="top"
 
| style="border: 1px solid #010101" width="216" |
 
percentile
 
| style="border: 1px solid #010101" width="222" |
 
number
 
|- align="left" valign="top"
 
| style="border: 1px solid #010101" width="216" |
 
quantile
 
| style="border: 1px solid #010101" width="222" |
 
number
 
|- align="left" valign="top"
 
| style="border: 1px solid #010101" width="216" |
 
select
 
| style="border: 1px solid #010101" width="222" |
 
empty
 
|- align="left" valign="top"
 
| style="border: 1px solid #010101" width="216" |
 
selectColumn
 
| style="border: 1px solid #010101" width="222" |
 
array
 
|- align="left" valign="top"
 
| style="border: 1px solid #010101" width="216" |
 
stdev
 
| style="border: 1px solid #010101" width="222" |
 
number
 
|- align="left" valign="top"
 
| style="border: 1px solid #010101" width="216" |
 
sterr
 
| style="border: 1px solid #010101" width="222" |
 
number
 
|- align="left" valign="top"
 
| style="border: 1px solid #010101" width="216" |
 
sum
 
| style="border: 1px solid #010101" width="222" |
 
number
 
|- align="left" valign="top"
 
| style="border: 1px solid #010101" width="216" |
 
variance
 
| style="border: 1px solid #010101" width="222" |
 
number
 
  
'''Example'''
+
|- valign="top" align="left"
 +
| style="border: 1px solid #010101" width="216" |
 +
min
  
number dcsResourceId1 = DCS_getCurrentDcsResourceId();
+
| style="border: 1px solid #010101" width="222" |
 +
number  
  
number dcsResourceId2 = 123456;
+
|- valign="top" align="left"
 +
| style="border: 1px solid #010101" width="216" |
 +
percentile
  
string expression1 = "average(Single2) where true;";
+
| style="border: 1px solid #010101" width="222" |
 +
number
  
string expression2 = "min(Single2) where true;";
+
|- valign="top" align="left"
 +
| style="border: 1px solid #010101" width="216" |
 +
quantile
  
DCS_use(dcsResourceId2);
+
| style="border: 1px solid #010101" width="222" |
 +
number
  
print(DCS_evaluateWhereExpression(expression1));
+
|- valign="top" align="left"
 +
| style="border: 1px solid #010101" width="216" |
 +
select
  
print(DCS_evaluateWhereExpression(expression2));
+
| style="border: 1px solid #010101" width="222" |
 +
empty
  
'''Availability'''
+
|- valign="top" align="left"
 +
| style="border: 1px solid #010101" width="216" |
 +
selectColumn
  
Version 5.8
+
| style="border: 1px solid #010101" width="222" |
__NOTOC__
+
array
<!-- imported from file: 7584.htm-->
+
 
 +
|- valign="top" align="left"
 +
| style="border: 1px solid #010101" width="216" |
 +
stdev
 +
 
 +
| style="border: 1px solid #010101" width="222" |
 +
number
 +
 
 +
|- valign="top" align="left"
 +
| style="border: 1px solid #010101" width="216" |
 +
sterr
 +
 
 +
| style="border: 1px solid #010101" width="222" |
 +
number
 +
 
 +
|- valign="top" align="left"
 +
| style="border: 1px solid #010101" width="216" |
 +
sum
 +
 
 +
| style="border: 1px solid #010101" width="222" |
 +
number
 +
 
 +
|- valign="top" align="left"
 +
| style="border: 1px solid #010101" width="216" |
 +
variance
 +
 
 +
| style="border: 1px solid #010101" width="222" |
 +
number
 +
|}
 +
 
 +
===== Example  =====
 +
 
 +
''number dcsResourceId1 = DCS_getCurrentDcsResourceId(); ''
 +
 
 +
''number dcsResourceId2 = 123456; ''
 +
 
 +
''string expression1 = "average(Single2) where true;"; ''
 +
 
 +
''string expression2 = "min(Single2) where true;"; ''
 +
 
 +
''DCS_use(dcsResourceId2); ''
 +
 
 +
''print(DCS_evaluateWhereExpression(expression1)); //return average value of question Single2 ''
 +
 
 +
''print(DCS_evaluateWhereExpression(expression2)); //return minimum value of question Single2 ''

Latest revision as of 09:57, 5 December 2018

DCS_evaluateWhereExpression


Evaluate a WHERE expression. See also DCS evaluateWhereExpressions for faster evalution of multiple expressions.

This function is an alias to EvalWhere in DataCacheSpecification class.

Syntax

DCS_evaluateWhereExpression(whereExpression)

Arguments

  • whereExpression: is string. ex: "selectColumn(Id) where true;"

Return value

Execute the where expression and return an object depending on where expression:

WhereExpression

Return type

average

empty

count

number

max

number

median

number

min

number

percentile

number

quantile

number

select

empty

selectColumn

array

stdev

number

sterr

number

sum

number

variance

number

Example

number dcsResourceId1 = DCS_getCurrentDcsResourceId();

number dcsResourceId2 = 123456;

string expression1 = "average(Single2) where true;";

string expression2 = "min(Single2) where true;";

DCS_use(dcsResourceId2);

print(DCS_evaluateWhereExpression(expression1)); //return average value of question Single2

print(DCS_evaluateWhereExpression(expression2)); //return minimum value of question Single2