Anveo Mobile App / Best Practices / Dynamically Change Field Layout by Data

Dynamically Change Field Layout by Data

By default, the layout of an Anveo Page is static and does not change. If you want to change the appearance at run time, e.g. colorize fields under certain conditions, highlight or replace field content, you can use your own code.

Dynamic field adjustments in the Anveo Mobile App can be defined using Anveo Script. The Action Code has to be set into OnAfterGetRecord – Action property of an Anveo Page Element. Anveo Script provides a set of options to change the field layout at runtime. A central role is played by command PAGE using first parameter SFA (= Set Field Attribute). The complete call of the function PAGE to implement a dynamic field change has the following form:

  • Fieldname is the Field Name of the field.
  • Attribute is the name of the attribute.
  • is the new value.

The second parameter must be an empty string due to future features.

List of attributes:

TextColor

Sets the text color of a field. The color must be defined using hexadecimal number such as #FF0000.

BackgroundColor

Sets the background color of a field. The color must be defined using hexadecimal number such as #FF0000.

TextAlign

Sets the alignment of text within a field (only on cards available). Possible values are:
left, right, center.


FontStyle

Sets the weight of the font in a field. Possible values are: bold, normal, italic, bold_italic.

FontSize

Sets the font size of the font in a field in percent (only on cards available).

Visible

Sets the visibility of a field. Possible values are: 0, 1.

Enabled

Sets whether the field is editable or not (only on cards available). Possible values are: 0, 1.

OnAfterGetRecord Example

Anveo Script code example ASLS_ONA:CONTACT on Anveo Page ASLS_CONTACTS that shows companies in bold, person contacts in normal font style.

The usage of dynamic layout using OnAfterGetRecord triggers and PAGE(’SFA’…) – commands in lists and cards are still in development. It is an experimental feature that should not be used in live systems until final feature availability will be announced.