Saltar al contenido

Introduction to App Builder - Lesson 2: Add data to your application

This is the second lesson of the Introduction to App Builder tutorial series.

Create a table

To start, you'll go to the data layer and create a table for the Northwinds application. As you are creating a simple order fulfillment application, you'll create a table to help differentiate between West Coast and East Coast markets.

  1. Select Action drawer > App Workbench.

  2. Go to the Tables tab and click the + Table button. The Table Definition page opens:

    Table definition page

    Note

    A + Table button can also be found in the App Workbench home page.

  3. In the Table panel, enter Region in the Name field.

    Note

    According to App Builder's naming conventions, table names should always be singular.

  4. (Optional) In the Technical Help field, enter a description of the purpose of this table. This information will not be visible to final users; it is meant to assist other developers.

  5. Click Save. After a few moments, the table will be created and you will be able to edit it.

  6. If you look in the Columns panel, you will see that your table already has a column. It is called RegionID, and App Builder created it automatically. It's been designated as the table's Primary Key, meaning it will be a unique identifier for the records in the table. Its Data Type has been set to UUID, which means that a unique 128-bit string of characters is automatically generated for this column.

  7. The RegionID column will be used by App Builder, but it isn't human-legible. We need to create a user-friendly column to identify the records in the Region table. These columns that are meant to be used as identifiers by end users are called title columns. They can be created automatically or manually.

    • To add the title column manually:

      1. Click the + Column button. The Column dialog will open:

        Column dialog

      2. In the Name field, enter Region.

      3. In the Data Types section, select String in the Logical menu. When you do that, the Physical menu should automatically select NVarchar, but if it doesn't, select it manually.

      4. In the Advanced section, the Column Usage Type field helps to signal the intended use of a given column, which can speed up later steps of the app's development process. It's likely that App Builder has already detected you're creating a user-friendly identifier and automatically selected Title in this field, but you can do this manually if it hasn't. Click Save.

    • To add the title column automatically:

      1. Click the + Title button. App Builder will ask for confirmation that you are trying to create a title column. Click Proceed.

      2. App Builder will automatically create and configure the title column. Note that the + Title button disappears once a title column has been created.

Note

For a complete description of all the options, see Edit a table in App workbench Tables tab.

Now that your table has the columns we'll need for now, your Columns panel should look similar to this:

Column panel

Your new table doesn't contain any records yet, but the underlying structure is in place to receive some. The RegionID column will hold a unique identifier that App Builder will use, and the Region column will hold a human-legible name.

Add records

Now that you have a new table that's ready to hold records, let's add the two that will help us differentiate between the different areas where our customers are located:

  1. In the Table panel, click the Results button. The Dynamic page will open.

  2. Click Create. A field will become available where you can type information. To save, click the checkmark icon. Remember that you should type only in the Region field, as the RegionID field will be created automatically by App Builder.

  3. Create two records: West Coast Region and East Coast Region. When you're done, the Dynamic page should look like this:

    Dynamic page with two records

That's it, the two records have been stored and we'll be able to use them in the next lessons.

Audit lite

A best practice recommended by Jitterbit is to always add audit information to the tables in your data layer. To make this easier, App Builder offers a feature called Audit Lite, with which you can easily make your tables auditable. We will use the audit lite feature on all tables in our Northwinds database, except Parameter.

  1. In the App Workbench > Tables tab, select any of your tables.

  2. In the Table panel, under the Accelerators section, click Enhance Table, then Proceed. App Builder will automatically create the following columns:

    1. AddedBy: The user name of the person who added a record.

    2. AddedOn: The date a record was added.

    3. ChangedBy: The user name of the last person to modify a record.

    4. ChangedOn: The date a record was last modified.

    5. IsActive: Indicates if a record is currently active or not.

    For instance, here's what the Category table should look like after the audit columns have been added:

    Audit lite columns

Repeat these steps for all other tables in the Northwinds database, except Parameter. Utilizing audit lite in your tables is a best practice that Jitterbit strongly recommends.

Review and wrap-up

Let's review what we've done in this lesson. We started with a freshly-created application connected to a data source. We then added a new table to it, which we'll use along with the other tables already there. Once our new table was set up and ready to receive records, we added some.

Now we are ready to move on to the next layer of application development, the business layer. Go to Lesson 3: Create rules.