Lava

This section will provide a reference to the lava functionalities available to you and in what context they are available.

Lava Filters

The Community page has a list of all the filters that are available. If a filter is available on the Mobile application it will be marked as such.

The Escape Filter

It is recommended to always include the Escape filter when using Lava text strings in a mobile application. This will encode the string, in case there are some crazy characters included in there that could break things.

{{ item.Title | Escape }}

Shell Lava Variables

The following variables and properties are available in all Lava contexts when executing Lava on the mobile application shell.

  • PageParameter

  • CurrentPerson

  • Device

  • PageValues

  • AppValues

CurrentPerson

The CurrentPerson object that is available on the mobile shell is a stripped down version of what you are used to using on the Server side. It does not support all the same properties, but most of the ones you are most likely to use should be available.

Property

Description

PersonAliasId

The primary person alias identifier associated with this person.

PersonId

The person identifier that matches up with the Person.Id you would use on the server.

FirstName

The given name of the person.

NickName

The name the person usually is addresses by.

LastName

The family name of the person.

Gender

The person's gender, if known.

Email

The primary e-mail address of the person.

BirthDate

The date the person was born, if known.

PhotoUrl

A url that can be used to display the person's profile image. If no image is available then this will be an empty string.

MobilePhone

The mobile phone number associated with this person.

HomePhone

The home phone number associated with this person.

CampusGuid

The GUID that identifies this person's primary campus.

Device

The Device variable gives you access to the type of device in use by the user. At present the following fields are available.

Property

Description

DeviceType

The type of device the shell is running on: Phone, Tablet, Watch, Unknown.

Manufacturer

The manufacturer of the device (e.g. Apple).

Model

The model of the device (e.g. iPhone 7).

Name

The name of the device. Note: this is often not a real device name as that is considered confidential information by Apple.

VersionString

The application version number of the Shell.

DevicePlatform

The platform the shell is running on: iOS, Android, Unknown.

Orientation

The current orientation of the device: Unknown, Portrait, Landscape.

Width

The width of screen (in relation to current orientation) in pixels.

Height

The height of screen (in relation to current orientation) in pixels.

Density

The pixel density of the screen (e.g. on an iPhone 7 this would be 2).

PageValues

Page values are used along with Page Events to allow you to customize your user experience. The PageValues object is just a dictionary of string/object pairs that you can use any way you want. There is no defined structure to them. You can read more about their use in the Page Events section.

AppValues

Similar to PageValues, the AppValues is a simple dictionary that you can store custom data into. However, the major difference is that AppValues will persist between application restarts. One simple usage might be to store a preference in how a page is displayed. You might present the user with a show/hide option that shows or hides certain elements on the page - all processed on the mobile shell. You can use AppValues for this and the value will persist between different visits to the page as well as a full restart of the application.

Server Lava Variables

When you are using Lava to customize the experience from the server side, for example in a Content block set to server-side Lava rendering, the following variables are available to you.

  • PageParameter

  • CurrentPerson

  • Device

In addition, the Content block defines these additional variables when processing a callback event. You can check out the Advanced: Dynamic Content page for more details on their contents.

  • Command

  • Parameters

Lava Commands

The mobile application provides a few additional Lava commands that you can use in different circumstances.

setpagevalue

This command allows you to set a specific value in the PageValues dictionary.

{% setpagevalue key, value %}

Both key and value can either be specified as literal values or as variable references, so both of the following are functionally the same.

{% assign name = 'MaxLength' %}
{% assign max = 100 %}
{% setpagevalue name, max %}
{% setpagevalue 'MaxLength', 100 %}

You can then access your PageValue by simply accessing it like any other Lava object, for example:

{% assign oldMax = UserValues.MaxLength %}

You can even access PageValues by way of bindings in your XAML:

<Label Text="{Binding UserValues.MaxLength}" />

setappvalue

This command allows you to set a specific value in the AppValues dictionary.

{% setappvalue key, value %}

Both key and value can either be specified as literal values or as variable references, so both of the following are functionally the same.

{% assign name = 'MaxLength' %}
{% assign max = 100 %}
{% setappvalue name, max %}
{% setappvalue 'MaxLength', 100 %}

You can then access your AppValue by simply accessing it like any other Lava object, for example:

{% assign oldMax = AppValues.MaxLength %}

You can even access AppValues by way of bindings in your XAML:

<Label Text="{Binding AppValues.MaxLength}" />

NOTE

Because these application values must be persisted to the local database, you should attempt to keep them limited to simple primitive types, such as numbers, strings, booleans. Any other more complex object or array types may or may not restore back from the database as you expect.