Difference between revisions of "The where Expression"

From Catglobe Wiki
Jump to: navigation, search
Line 1: Line 1:
 
[[Category:CGScript]]
 
[[Category:CGScript]]
 

 

 +
{{category tree all|CGScript|mode=parents|hideroot=on|depth=2}}
 +
{{category tree all|CGScript|mode=all|hideroot=off|depth=1}}
  
 
==The where Expression==
 
==The where Expression==

Revision as of 10:17, 6 December 2011



To display all parents click on the "+":
CGKB



To display all pages, subcategories and images click on the "+":
CGScript(9 C, 3 P)

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