Get a note
PHP
$d=Data::cache("notes", "view", "all");$d->setFilter("nr=1"); //pretty much the same as getting an item
if($d->get()&&$d->next())
print $d->v["name"];
Get a list of notes that contain some text
PHP
$d=Data::cache("notes", "view", "all");$d->setFilter("catnr=@catnr AND name like('some text')"); //Get a dynamic list based on the value set in the "catnr" field ($d->setValue("catnr", ...)) and use the like operator to search
if($d->get())
while($d->next())
print $d->v["name"];
Get the notes in all subcategories of a category that are owned by you or contain your or are added before April 1st
PHP
$d=Data::cache("notes", "view", "all");$d->setFilter("catnr.catnr=123 AND (owner=@owner OR added<'00:00:00 01-04-2016'"); //catnr is the reference to the notes' category and the second catnr is its reference to its parent category, again setting a setting static value 123. The nested section between brackets ensure the first statement must always by true regardless of the outcome of the other 2 statements.
Get a list of notes based on a variety of category names
PHP
$d=Data::cache("notes", "view", "all");$d->setFilter("catnr.name in('static name', @array1.0, @array2, text)"); //any note will be displayed that is in a category which matches any of the names in the "in" function: 'static name' is merely a static value, @array1.0 assumes a field named array1 and it uses its first value, @array2 again is an array field and it uses any of the values in that array and lastly it may match the text of a note...?
We'll I guess you get the gist of it. Here's an overview of the various operators and functions:
- Operators: =, >=, <=, >, <, !=, & and |
- Functions:
- like, not like
- start like, not start like
- end like, not end like
- in, not in (unlike the other functions these can have as many arguments as needed, even combining variables, references and static values is possible)
- between, not between (unlike the other functions these required 2 arguments: from and to)