#[derive(BusinessObject)]
{
// Attributes available to this derive:
#[object]
#[field]
#[rule]
#[appearance]
#[variant]
#[list_filter]
#[action]
}
Expand description
Declares a struct as a business object: an entity for the model, and the way to and from a record.
On the struct, #[object(caption = "...", navigation = "...", icon = "...", list_criteria = "...", form_columns = 2, cloneable, transient, checks_on_leave, list_editable, data_access = "server", form_actions = "name", focus_order = "a,b")], where data_access is
client, server or data_view, and focus_order the fields the form goes through first.
On a field, #[field(...)]:
keynumbered by the application, ortyped_keytyped by people. Exactly one field has one. Withguid, akeyis made up when a record is created instead of being numbered.caption = "..."what people see.default_propertywhat names a record.read_only.no_list,no_detail,lookup.- What it holds, when the type does not say:
money,long,color,date,guid,decimals = 2,reference = "Entity",collection = "Entity",tags = "a,b". calculated = "[a] + [b]", in the criteria language, checked here.default = ...what a new record starts with.required,unique,min = 1,max = 10,matches = "^[A-Z]+$": what it has to meet on saving, andmessage = "..."what to say instead of the usual words.- On a form:
editor = "...",placeholder = "...",hint = "...",wide,autofocus,group = "..."for the titled group it goes in,edit_mask = "(00) 0000-0000",predefined = "a,b"for values to pick from,criteria_of = "Entity"for a filter builder. - For screen readers:
accessible_name = "..."instead of the caption, andaccessible_description = "..."instead of the hint. display_format = "{:.2} %", how its value shows when it is not being edited.- On a reference:
lookup_filter = "[flow] = ?flow",none_caption = "...". On a collection:back_reference = "...",aggregated.secretnever leaves a secured space.non_cloneablestays behind on cloning, andmost_bytes = 1024limits a picture or a file.
On the struct, as many as needed:
#[rule(criteria = "[a] <= [b]", message = "...", context = "Pay", target = "[c] > 0")], or#[rule(unique = "a,b")]. Withwarningpeople can go on anyway, and withinformationit only leaves a note. A message can say{field}and{reference.field}.#[appearance(names = "a,b*", criteria = "...", font = "danger", back = "warning", bold, enabled = false, visible = false, priority = 1, context = "list", action)]. Withlayout, the names are groups of a form; withaction, actions. A context islist,detailor a view’s id. Tints aredanger,warning,success,accentandmuted.#[action(caption = "...", set = "state = 'done'; finished = Today()", enabled = "...", selection = "many", confirm = "...", id = "...")]: an action that sets fields of the records selected, each read from the record as it was, and keeps them once they meet the rules.selectionisone,many(the default) orany;enabledis what every record selected has to meet for it to be on. Both expressions are checked here.#[variant(id = "...", caption = "...", filter = "...", columns = "a,b")]and#[list_filter(id = "...", caption = "...", filter = "...")], for people to pick on the list.