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:

PAGE('SFA','',Fieldname,Attribute,Value)
  • 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

if (Rec:GETVALUE_INT('Type') == 0) then
PAGE('SFA','','2','FontStyle','bold');
else
PAGE('SFA','','2','FontStyle','normal');
end;
Anveo Script code example ASLS_ONA:CONTACT on Anveo Page ASLS_CONTACTS that shows companies in bold, person contacts in normal font style.