Search


Ploticus > Scripts >
conditional expressions for selecting data rows




select attributes

These are used to select certain records from the current data set. Many of the ploticus procs support a select attribute.




Examples

select: @@2 = A         (select all records where 2nd field is A)

select: @@2 < 100         (select all records where 2nd field less than 100)

select: @@group in C,D         (select all records where the group field is C or D. this assumes that data fields have been given names)

select: @@group in C,D && @@sex = f         (select all records where the group field is C or D and the sex field is f.




Notes

As seen in the above examples, two at-signs (@@) must be used when the select statement resides within a ploticus script and will be subjected to the script interpreter. Character constants should not be enclosed in quotes. Parentheses may not be used to establish precedence.




Operands

Operands may be
    field numbers, e.g. @@1 is the first data field
    field names, e.g. @@group (field names must be in effect)
    Ploticus @variables or variables that you set (use one at-sign)


Comparison operators

    = 	Equal to.  This is case sensitive for strings. 
    !=	Not equal to. 
    > 	Greater than.
    >= 	Greater than or equal to. 
    <  	Less than. 
    <= 	Less than or equal to. 
    

Data types: if both sides of a comparison are numeric, a numeric comparison will be done. Otherwise, a string comparison will be done.

Wild card matching: Wild card matching may be done using like. Wild card characters are * which matches any number of any character, and ? which matches a single instance of any character. This matching is case-insensitive.

    like	Wild card match.  Example: hello like h* (true)
    !like	Not a wild card match.
    
    

Commalist operators: these take a commalist on the right side.

    in	Member of list.  Example: z in x,y,z (true)
    !in	Not a member of list. (Alt: ni)
    inlike 	Same as in but wild card matching is used.
    		(Wild cards may be used in list members.)
    !inlike	Same as !in but wild card matching is used.
    





Logical connectors

Individual conditional expressions may be connected together using logical AND (&&) or OR (||). An entire expression may be negated by putting not: at the beginning of the expression.

Because parentheses may not be used to establish precedence mixing AND and OR in the same expression requires care. When the expression is parsed, it is first split into OR terms, then each of the OR terms is split into AND terms. For example: A = B and C = D or E = E of F = G would evaluate to true, because it is interpreted as if it were written (a = B and C = D) or (e = e) or (f = g). It may be best to avoid mixing AND and OR in the same expression and use multiple expressions instead.




Limitations and bugs

Because parentheses may not be used to establish precedence, the mixing of AND and OR in the same expression is problematic (see above).

 


Ploticus 2.42 ... May 2013 Terms of use /