HTML

What is the HTML component?

The HTML component enables you to add any custom HTML to the page in a contained component. Unlike the other System Components, the HTML component in certain conditions can display details of a record through Formatted Values. In all instances, it can display App Variables as well as Logged-In Fields related to user values.

The HTML component is a WYSIWYG (What You See Is What You Get) editor and works similarly to any word processing program. 

Variables

Variables can be used throughout your app to reference data that is stored in tables or configured through App Variables Settings. When adding these values into your HTML component the data will be dynamically updated to whatever values it was set to. 

There are 4 main types of App Variables:

  • Logged-in Fields are specific to the current logged in user.

  • App Variables are configured through the App Variables Settings page.

  • Formatted Values from the current record being referenced in components.

  • Raw Values from records reference fields within certain records including Name, Address, Link, Image, and File.

  Format Example Output
Logged In Field {loggedInUser.Name} John Doe
App Variable {!currentTime!} 05:48 PM
Formatted Record Value {Email Address} john@example.com
Raw Record Value {!!Email Address!!} john@example.com
Raw Object Record Value {!!Address.zip!!} 90010

 

Let’s explore each of these variables in depth.

Logged-in Fields

When the option to Add Logged-in Field is selected through an HTML component, you may choose to reference fields from the record in the Users table for the specified logged-in user. By default, the available fields are Name, Email, Status, and Role where these options depend on the corresponding fields configured in the User’s table of the given app.

App Variables

App Variables are the reference-able values that can be configured in the App Variables Settings page. There are 5 default variables in place and any additional variables configured will be listed below where any custom variables added can be edited and deleted.

There are two main ways to configure App Variables.

Static App Variables

Static App Variables are predefined keys that are associated with a value and are formatted between curly braces and exclamation points. Similar to this: {!companyName!}

With an app variable you can define that {!companyName!} is equal to “My Company, LLC” and if you ever need to change this such as if you’re building this app for several clients you simply change it once and it will dynamically update each instance of the variable.

Formula App Variables

Dynamic App Variables are similar to Static App Variables (outlined in the previous section) and are used the same way, however, the value that will be outputted are number values from a predefined condition.

For example, this can be anything similar to Complex Formulas, namely: Count, Sum, Max, Min and Average. As an example, you can create a variable called “Total Jobs” which will count all the jobs in the database.

 

When using Formula Variables you can add conditions as well. In the example above, we can also choose to add conditions to only count jobs where the status is Done. 

App variables are only loaded when the page loads and not auto refreshed with record changes until the page reloads again. If you're looking at displaying live data inside your app as a summary, but sure to check the Card component. 

 

Formatted Record Values

When working with HTML components on various pages, you may notice an Add Field button available next to the options to select App Variables or Logged-in Fields. The options available within this selection are known as Formatted Values and are available on HTML components placed on dependent Details or Edit pages or within List components.

Accessible through HTML components applied to dependent pages or List components are Formatted Values which reference record-specific values.

The main difference between these two types of HTML components is that one on a dependent page or in a List component has a specific table and record to reference where one within an independent page is not connected to a table or record.

Raw Record Values

Raw record values will output just the value without any formatting. For example, instead of an email being displayed as a link (<a href="mailto:mailto=john@example.com">john@example.com</a>), it will appear as plain text: john@example.com

Raw Object Values

When a field is considered an object, you can access any part of that object with a unique variable. 

Objects are any field that contain  multiple columns that make up its final value, for example: 

  • Name (Title, First Name, Middle Name, Last Name)
  • Address (Address1, Address2, City, State, Zip, Country, Lat, Lon)
  • Image (Name, URL)
  • File (Name, URL)

Listed below are name formats that can be followed when referencing your variables.

First let's see how the output looks with formatted values: 

html-non-raw-objects.jpg

As you can see all the values are outputted as a single value. If we wanted to reference a single part of the value, for example, just the city of an address field we can do so with Raw Values: 

  • Address

    • Address: {!!Address.address!!}

    • Address Line 2: {!!Address.address2!!}

    • City: {!!Address.city!!}

    • State: {!!Address.state!!}

    • Zip: {!!Address.zip!!}

    • Country: {!!Address.country!!}

    • Latitude: {!!Address.lat!!}

    • Longitude: {!!Address.lng!!}

    html-address-raw.jpg

  • Name

    • Title: {!!Name.title!!}

    • First Name: {!!Name.first_name!!}

    • Last Name: {!!Name.last_name!!}

    • Middle Name: {!!Name.middle_name!!}

    HTML-name-raw.png

  • File

    • Source: {!!File.url!!}

    • Name: {!!File.name!!}

    html-raw-file.jpg

     

  • Image

    • URL: {!!Image.src!!}

    • Name: {!!Image.name!!}

    html-raw-picture.jpg

     

You can also access the record ID by passing raw variable of {!!id!!} This can be especially helpful when you want to use this in links, or in emails to link back to a specific record. 

When referencing the desired Raw Variable, we will take the given field Name and the original Label. This means that, regardless of the custom label configured for the variable, the original will always be used when referencing the Raw Variable.

For example, we may include an Address Field in a Client table named Client Address. For the Zip value, we apply the custom label Postal Code. When referencing this value through Raw Variables in our app, we will use the following format referencing the value through the original label: {!!Client Address.zip!!}.