id, label and code for a picker, for any entity — choosable is not the same as editable.
code is the register’s own short identifier where it has one — the asset number, the part number,
the site code. Names are unique on almost none of these tables, so a picker labelled by
name alone offers two identical rows and no way to tell which is which; this is the column that
settles it, and the search matches it as well as the name.
A register that is a tree answers with its depth and its readable path as well, so the picker draws
the hierarchy rather than a flat alphabetical list of leaves. p_for_entity names the form doing the
asking, which only config.states needs: it holds every entity’s states and a form wants its own.
The scope narrows the list to one parent’s rows, which is what makes a two-hundred-row subdivision
list usable. p_scope_optional lets that run the other way: with no scope id it returns the whole
register instead of nothing, and every row carries its own value of the scope column, so a form may
offer the child first and fill the parent in from whichever one gets chosen.
p_for_record_id names the record being edited, which matters on the fourteen columns that point
back at their own register: it and everything already inside it come out of the list, because a
record cannot be filed under itself.
p_at_site_id names the site the form has reached, which only core.asset_categories reads: a class
of asset says where it exists, inheriting the rule of the nearest category above it, and a picker on
a form that has named a site offers what that site has. A form that has not named one
narrows nothing.
p_at_location_id and p_in_category_id are the other two things a form may already have settled,
and three registers read them. An asset is offered at the place and in the class the form named, and
in every class beneath that one, so a job raised about a centrifugal pump is not asked to find it
among fifty thousand. A kind of job and a level of urgency are offered where the tenant said they
apply: an empty set of sites or of classes means everywhere rather than nowhere, so a register nobody
has scoped is offered whole. A kind of job restricted to particular roles is also offered only to a
caller holding one of them, which is a rule about the reader rather than about the form and so
applies whatever else has been named.
p_keep_id is the row the form already names, and it comes back through every one of those
narrowings and through the exclusion of an asset that has left service. Narrowing a picker on a
record that exists is not the same act as narrowing one on a blank form: a pump moved to the
workshop is still the machine the job is about, and a list that dropped it would leave the control
with nothing to label the value it is holding. It does not reopen what the register excludes — a
deleted row stays gone, and a row cannot be offered as its own parent.
choosable appears when the caller names the field it is asking on behalf of and the organisation has
said that field is answered with the last level of its tree: false marks a row with something under
it, which the picker draws as a heading rather than a choice. The rows are all still there — a branch
is how somebody finds and reads what is under it — and leaf is relative to this list, so a branch
whose every child is scoped out of this site is choosable here. A caller that names no field is
answered without the key at all, which is every picker that reads a tree in order to scope a rule
rather than to file a record.
The order is the register’s own arrangement where it has one — the column a person dragged the list
into, or the sort_order a register with no admin screen carries anyway — with the name as
the tie-break. Everything else is alphabetical by name. A tree is ordered so that a parent comes
immediately above its own children, by path where the register has no arrangement and by the
arrangement at each level where it has one, so that the indent and the order a person chose are both
true of the same list.
p_ids asks for the labels of particular rows instead of a page of the register: what a picker needs
when the value already chosen is not among the first rows it was shown, which on a register of tens of
thousands is most of them. The answer is those rows, as the list would label them, and nothing else.
Query Parameters
Response
OK

