Difference between revisions of "DCS evaluateWhereExpression"

From Catglobe Wiki
Jump to: navigation, search
(Example)
(DCS_evaluateWhereExpression)
(Tag: visualeditor)
Line 3: Line 3:
 
__NOTOC__
 
__NOTOC__
  
Evaluate a WHERE expression  
+
Evaluate a WHERE expression. See also [[DCS evaluateWhereExpressions]] for faster evalution of multiple expressions.
  
 
=== Syntax  ===
 
=== Syntax  ===
Line 17: Line 17:
 
Execute the where expression and return an object depending on where expression:  
 
Execute the where expression and return an object depending on where expression:  
  
{| width="438" cellpadding="2" border="1" style="border-collapse: collapse; border: 1px solid #010101" class="tableintopic"
+
{| class="tableintopic" style="border-collapse: collapse; border: 1px solid #010101" width="438" cellpadding="2" border="1"
 
|- valign="top" align="left"
 
|- valign="top" align="left"
| width="216" bgcolor="#C0C0C0" style="border: 1px solid #010101" |  
+
| style="border: 1px solid #010101" width="216" bgcolor="#C0C0C0" |  
 
'''WhereExpression'''  
 
'''WhereExpression'''  
  
| width="222" bgcolor="#C0C0C0" style="border: 1px solid #010101" |  
+
| style="border: 1px solid #010101" width="222" bgcolor="#C0C0C0" |  
 
'''Return type'''  
 
'''Return type'''  
  
 
|- valign="top" align="left"
 
|- valign="top" align="left"
| width="216" style="border: 1px solid #010101" |  
+
| style="border: 1px solid #010101" width="216" |  
 
average  
 
average  
  
| width="222" style="border: 1px solid #010101" |  
+
| style="border: 1px solid #010101" width="222" |  
 
empty  
 
empty  
  
 
|- valign="top" align="left"
 
|- valign="top" align="left"
| width="216" style="border: 1px solid #010101" |  
+
| style="border: 1px solid #010101" width="216" |  
 
count  
 
count  
  
| width="222" style="border: 1px solid #010101" |  
+
| style="border: 1px solid #010101" width="222" |  
 
number  
 
number  
  
 
|- valign="top" align="left"
 
|- valign="top" align="left"
| width="216" style="border: 1px solid #010101" |  
+
| style="border: 1px solid #010101" width="216" |  
 
max  
 
max  
  
| width="222" style="border: 1px solid #010101" |  
+
| style="border: 1px solid #010101" width="222" |  
 
number  
 
number  
  
 
|- valign="top" align="left"
 
|- valign="top" align="left"
| width="216" style="border: 1px solid #010101" |  
+
| style="border: 1px solid #010101" width="216" |  
 
median  
 
median  
  
| width="222" style="border: 1px solid #010101" |  
+
| style="border: 1px solid #010101" width="222" |  
 
number  
 
number  
  
 
|- valign="top" align="left"
 
|- valign="top" align="left"
| width="216" style="border: 1px solid #010101" |  
+
| style="border: 1px solid #010101" width="216" |  
 
min  
 
min  
  
| width="222" style="border: 1px solid #010101" |  
+
| style="border: 1px solid #010101" width="222" |  
 
number  
 
number  
  
 
|- valign="top" align="left"
 
|- valign="top" align="left"
| width="216" style="border: 1px solid #010101" |  
+
| style="border: 1px solid #010101" width="216" |  
 
percentile  
 
percentile  
  
| width="222" style="border: 1px solid #010101" |  
+
| style="border: 1px solid #010101" width="222" |  
 
number  
 
number  
  
 
|- valign="top" align="left"
 
|- valign="top" align="left"
| width="216" style="border: 1px solid #010101" |  
+
| style="border: 1px solid #010101" width="216" |  
 
quantile  
 
quantile  
  
| width="222" style="border: 1px solid #010101" |  
+
| style="border: 1px solid #010101" width="222" |  
 
number  
 
number  
  
 
|- valign="top" align="left"
 
|- valign="top" align="left"
| width="216" style="border: 1px solid #010101" |  
+
| style="border: 1px solid #010101" width="216" |  
 
select  
 
select  
  
| width="222" style="border: 1px solid #010101" |  
+
| style="border: 1px solid #010101" width="222" |  
 
empty  
 
empty  
  
 
|- valign="top" align="left"
 
|- valign="top" align="left"
| width="216" style="border: 1px solid #010101" |  
+
| style="border: 1px solid #010101" width="216" |  
 
selectColumn  
 
selectColumn  
  
| width="222" style="border: 1px solid #010101" |  
+
| style="border: 1px solid #010101" width="222" |  
 
array  
 
array  
  
 
|- valign="top" align="left"
 
|- valign="top" align="left"
| width="216" style="border: 1px solid #010101" |  
+
| style="border: 1px solid #010101" width="216" |  
 
stdev  
 
stdev  
  
| width="222" style="border: 1px solid #010101" |  
+
| style="border: 1px solid #010101" width="222" |  
 
number  
 
number  
  
 
|- valign="top" align="left"
 
|- valign="top" align="left"
| width="216" style="border: 1px solid #010101" |  
+
| style="border: 1px solid #010101" width="216" |  
 
sterr  
 
sterr  
  
| width="222" style="border: 1px solid #010101" |  
+
| style="border: 1px solid #010101" width="222" |  
 
number  
 
number  
  
 
|- valign="top" align="left"
 
|- valign="top" align="left"
| width="216" style="border: 1px solid #010101" |  
+
| style="border: 1px solid #010101" width="216" |  
 
sum  
 
sum  
  
| width="222" style="border: 1px solid #010101" |  
+
| style="border: 1px solid #010101" width="222" |  
 
number  
 
number  
  
 
|- valign="top" align="left"
 
|- valign="top" align="left"
| width="216" style="border: 1px solid #010101" |  
+
| style="border: 1px solid #010101" width="216" |  
 
variance  
 
variance  
  
| width="222" style="border: 1px solid #010101" |  
+
| style="border: 1px solid #010101" width="222" |  
 
number  
 
number  
 
|}
 
|}

Revision as of 09:56, 5 December 2018

DCS_evaluateWhereExpression


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

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