Syntax |
Means |
Examples |
X |
refers to the field named X . |
info , META:TOPICMOVED , attachments , name . |
X.Y |
refers to the entry with the key Y in the structure named X |
info.date , moved.by , META:TOPICPARENT.name |
X[query] |
refers to all the elements of the array X that match query. If query is of the form name='Y' then you can use the same X.Y syntax as is used for accessing structures. |
attachments[size>1024] , DocumentForm[name!='Summary' AND value~'top secret'].value , DocumentForm.Summary |
X[N] |
where X is an array and N is an integer number >= 0, gets the Nth element of the array X |
attachments[3] |
X/Y |
accesses Y from the topic specified by the value of X . X must evaluate to a topic name |
parent.name/(form.name='ExampleForm') will evaluate to true if (1) the topic has a parent, (2) the parent topic has the main form type ExampleForm . |
Note: at some point TWiki may support multiple forms in the same topic. For this reason you are recommended **not** to use the `fields` shortcut when accessing form fields, but always use the name of the form instead.
There is a shortcut for accessing form fields. If you use the name of a field (for example, `LastName`) in the query without a . before it, that is taken to mean "the value of the field named this". This works if and only if the field name isn't the same as of the top level entry names or their aliases described above. For example, the following expressions will all evaluate to the same thing:
- `PersonForm[name='Lastname'].value`
- `Lastname`
- `PersonForm.Lastname`
If `X` would conflict with the name of an entry or alias (e.g. it's `moved` or maybe `parent`), you can prepend the name of the form followed by a dot, as shown in the last example.
##
Operator |
Meaning |
= |
Left-hand side (LHS) exactly matches the value on the Right-hand side (RHS). Numbers and strings can be compared. |
!= |
Inverse of = . |
~ |
wildcard match ('*' will match any number of characters, '?' will match any single character e.g. "PersonForm.Surname ~ '*Smit?'") Note: Surname ~ 'Smith' is the same as Surname = 'Smith' |
< |
LHS is less that RHS. If both sides are numbers, the order is numeric. Otherwise it is alphabetic (applies to all comparison operators) |
> |
> |
>= |
>e; |
<= |
<e; |
lc(x) |
Converts x to lower case, Use for caseless comparisons. |
uc(x) |
Converts x to UPPER CASE. Use for caseless comparisons. |
d2n(x) |
Converts a date (expressed in [[Main/TimeSpecifications]]) to a number of seconds since 1st Jan 1970. This is the format dates are stored in inside TWiki, and you have to convert a string date using d2n before you can compare it with - for example - the date an attachment was uploaded. Times without a timezone are assumed to be in server local time. If you have date fields in your forms, note that they are not stored in TWiki's internal format, but are stored as text strings. You should still use d2n to convert them to numbers for comparisons, though. |
NOT |
Invert the result of the subquery |
AND |
Combine two subqueries |
OR |
Combine two subqueries |
() |
Bracketed subquery |
%I% The same operators are supported for [[%IF statements|Main/VarIF]].
##