Can I specify more than one where and order parameter?
Yes — these are multiple parameters.
In what order are where and order applied?
where and order — multiple parameters and are applied from left to right. They both have a non-single structure.
where:
where: + 'FIELD_NAME' + COMPARISON_OPERATOR + VALUE_FOR_COMPARISON
=: select(table: 'payments'; field: 'summ'; where: 'order_id' = #id)
=: selectList(table: 'clients'; field: 'client_name'; where: 'total' > $calc)
calc: #plan_for_manager * 4
The following comparisons are available:
= — equal or intersection.
!= — not equal or no intersection. Typed as ! + =.
> — greater than.
< — less than.
>= — greater than or equal to. Typed as > + =.
<= — less than or equal to. Typed as < + =.
== — completely equal for lists, associative arrays, and lists of associative arrays. Typed as = + =.
!== — completely not equal for lists, associative arrays, and lists of associative arrays. Typed as ! + = + =.
order:
order: + 'FIELD_NAME' + SORT_DIRECTION
=: selectList(table: 'clients'; field: 'client_name'; order: 'income_group' desc; order: 'client_name' asc)
// first they will be sorted by income_group in descending order, and those in the same group by client_name in ascending order
asc — ascending.
desc — descending.
If the sort direction is not specified, it will be ascending asc by default.
How do I specify whether to sort in ascending or descending order?
asc — ascending.
desc — descending.
If the sorting direction is not specified, it will be ascending asc by default.
Do I have to use sorting?
No. If not specified, the values for the lists will be returned in random order.
How do I turn off where by conditions?
You need to pass the value *ALL* to where:
=: selectList(table: 'clients'; field: 'client_name'; where: 'total' > $if)
if: if(condition: #total > 10000; then: "*ALL*"; else: #total)
If the value in the total field is greater than 10000, the where parameter in the selectList function will be disabled.