Difference between revisions of "The where Expression"

From Catglobe Wiki
Jump to: navigation, search
(The where Expression)
(Tag: visualeditor)
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
[[Category:CGScript]]
+
{{HelpFiles}}

+
 
 +
== The where Expression ==
 +
 
 +
This feature is the most significant difference of CGS considered to other programming languages. It is used with a data table context.
  
==The where Expression==
+
The general form of the where expression is specified below:
  
This feature is the most significant difference of CGS considered to other programming languages. It is used with a data table context.
+
''function_exp where [(]condition[)]''
  
The general form of the where expression is specified below:
+
*''function_exp'' must be one of the special built-in functions used only with where (see [[DCS evaluateWhereExpression]]). The parameters for these functions must be simple expressions using arithmetic operators; they cannot contain any calls to the library functions.
 +
*''condition'' is a boolean expression, it can merely contain simple arithmetic, relational and logical operators (see Operators).
  
''function_exp where [(]condition[)]''
+
Parenthesis enclosing conditions are optional.
  
* ''function_exp'' must be one of the special built-in functions used only with where (see Functions “ Functions Used in where Expressions). The parameters for these functions must be simple expressions using arithmetic operators; they cannot contain any calls to the library functions.
+
For example, in order to get the number of students in class 1, and assign it to a variable named student_num, we use the statement below:
* ''condition'' is a boolean expression, it can merely contain simple arithmetic, relational and logical operators (see Operators).
 
  
Parenthesis enclosing conditions are optional.
+
{| class="tableintopic FCK__ShowTableBorders" style="border-collapse: collapse;" width="590" cellpadding="2" bgcolor="#c0c0c0"
 +
|- valign="top" align="left"
 +
| width="590" bgcolor="#c0c0c0" |
 +
number student_num = count() where (ClassId==1); 
  
For example, in order to get the number of students in class 1, and assign it to a variable named student_num, we use the statement below:
+
|}
  
{| class="tableintopic" style="border-collapse: collapse" width="590" cellpadding="2" bgcolor="#C0C0C0"
+
[[Category:CGScript]]
|- align="left" valign="top"
 
| width="590" bgcolor="#C0C0C0" |
 
number student_num = count() where (ClassId==1);
 
__NOTOC__
 
<!-- imported from file: 281.htm-->
 

Latest revision as of 10:01, 5 December 2018



The where Expression

This feature is the most significant difference of CGS considered to other programming languages. It is used with a data table context.

The general form of the where expression is specified below:

function_exp where [(]condition[)]

  • function_exp must be one of the special built-in functions used only with where (see DCS evaluateWhereExpression). The parameters for these functions must be simple expressions using arithmetic operators; they cannot contain any calls to the library functions.
  • condition is a boolean expression, it can merely contain simple arithmetic, relational and logical operators (see Operators).

Parenthesis enclosing conditions are optional.

For example, in order to get the number of students in class 1, and assign it to a variable named student_num, we use the statement below:

number student_num = count() where (ClassId==1);