Professional Documents
Culture Documents
In order to complete the tutorial, you will need an Appian 19.3 (or
later) practice environment.
This exercise is the fourth exercise in the Advanced Interfaces Exercise Series.
The four exercises accompany our courses Interfaces 102 & Interfaces 103:
This is the last exercise in our Advanced Interfaces Exercise Series. If you are
using the trial version of Appian and want to keep your sample interfaces as a
Editable Grids are a powerful tool in Appian. With it, you will be able to build tables that users
can edit directly from the interface. In this exercise, we will build a grid that will allow users to
add and remove the rows of information by simply clicking the Add New Item link or the red X
delete button:
To complete this exercise, we will create a couple of Getting Started objects. First, we will build
a CDT to provide a data structure for our office supply items. Second, we will create a constant
to hold the categories of office supply items. Third, we will build a simple interface containing a
rule input and a local variable that will hold the values for the office supply items (until we save
them into the rule input). After this prep work, we will add the Editable Grid component to the
interface, and we will configure its elements such as header cells, rows, and dynamic links. We
will build the grid using the Design Mode, and we will fine-tune it the Expression Mode.
While working with Editable Grids might seem taxing at first, this exercise will provide you with
the opportunity to learn more about the Hierarchy Interface feature that will help you locate
the appropriate screens and configurations quickly.
Before we can build the Editable Grid component, we need to create a CDT that will provide a
structure for our office supply data. We will also need to create a constant that will hold the
categories for a dropdown field that we will have in the grid. Follow the steps below to create
these objects:
1. Log into your Appian environment, and open the ADV Interface Practice application.
Click New, and select Data Type. Select the radio button Create from scratch. To
follow along with Appian’s best practices, edit the Namespace field to include the
application prefix ADV: urn:com:appian:types:ADV. Type ADV_Items in the Name
field, and add a brief description (“Provides the structure for each item in the purchase
request”). Click Create.
2. Add the CDT fields that will provide the structure for our editable Grid. Use the image
below to guide you through this process:
Check the Array box in the itemID row. Also, click the key icon for the itemID, and then
set it as the primary key and check the Auto-generate box:
Remember to click Save Changes after you add all fields to the CDT.
3. Now that you have created the ADV_Items CDT, let’s add it as a new entity to our
existing data store ADV DS. Navigate to ADV DS, and open it. Scroll down, and click
4. Create a constant to hold the categories for our Editable Grid. Click New > Constant. In
the Create Constant dialog box, name the constant
ADV_PURCHASE_REQUEST_CATEGORIES, and provide a brief description
(“Constant to hold the categories for the Purchase Request grid”). Select Text as the
type, check the Array box, and enter the categories (Office Supplies, Hardware,
Software, Miscellaneous) into the Values field. Do not use any punctuation, and enter
each item on a new line. In Save In, select the ADV Constants folder. Click Create. Your
entries will look as follows:
In this part, we will create a basic interface, and then we will add local variables and a rule input
to it. Local variables will help us handle the information entered by users. The rule input will map
the information about each office supply item to the corresponding columns of the database
table. Follow the steps below to set up the interface:
1. In the Appian Designer, click New > I nterface. Name the interface ADV_EditableGrid,
add a simple description, select the ADV Interfaces folder for the Save In field, and click
Create.
2. From the Select a template pane on the right-hand side, select the one-column
template. Click the template to set up the form. After the form is displayed, delete one of
4. Click the Expression Mode button on the toolbar. In the Interface Definition pane, fold
the blank section layout by clicking the arrow next to line 1:
a. Place the cursor before a!formLayout, and press Enter. On line 1, type
a!localVariables. Delete the closing parenthesis at the end of line one, and
press the down arrow to move to the end of line 2. Press Enter, and type the
closing parenthesis for the a!localVariables function. This wraps the interface
components within the local variable.
b. Return to the end of line 1. Press Enter to add another line, and type
local!newGridRow to create the local variable for the form. Type the colon, and
use the type constructor to map the local variable to the desired data type. In our
case, it will be the ADV_Items CDT. Type type!, and use the autocomplete to
select the correct CDT. After the correct data is inserted, click at the end of the
line, and add a comma to separate the local variable from the rest of the
interface. Your expression will look as follows:
The rule input ADV_Items will help us map the information provided about each
item to the columns in the database table.
b. In the New Rule Input dialog box, enter the name items. In the T ype field,
remove the Text data type and start typing ADV_Items to select the data type
that we need for this exercise. Finally, select the Array checkbox. The Array
option for the rule input will allow users to add multiple items via this interface.
c. Click Create.
Next, let’s add the Editable Grid to the interface. This step will involve working in the Design
Mode. We will drag the Editable Grid component to the canvas first, and then we will use the
options available via the Design Mode to configure the Headers and Rows for our Grid. Follow
the steps below to configure the grid.
1. Click Design Mode on the toolbar. In the Components Palette, scroll down to the Grids
group.
2. Drag the Editable Grid component onto the canvas. Notice that its properties are now
displayed in the Component Configuration pane. Scroll down in this configuration pane
to configure the fields of the Editable Grid.
4. Scroll down to Header Cells, and click the link List of Any Type. We will need six
headings for our grid. Five to describe the columns of data for each item, and we will
5. Press the Edit as Expression button on the top right of the component configuration:
6. You will notice that the Header Cells dialog box contains the list of header cell
components that we just created. In the Expression, change the Header Cell labels to:
● Description
● Category
● Qty
● Unit Price
● Amount
● Blank: use the open and close quotation marks to create a blank header (we will
use for the Delete an Item column.
Navigating between the elements of an Editable Grid might feel confusing at times, and it might
take time to get used to moving between the elements using the Up Arrow, especially if you
drilled deeply into the components of the grid. If at any point you need a reminder where you are
in the grid, pull out the Interface Hierarchy to quickly scan your interface. If you recall, we
learned to use this helpful tool in your previous exercise. To pull out the Interface Hierarchy, rest
the pointer on the left border of the Component Configuration pane. When you notice that it
turned into a slider, pull the full Component Configuration out to show the Interface
Hierarchy.
Examine the columns in the Edit pane, and notice that the widths of columns changed.
Click the Up Arrow button once to return to the Column Configurations, and click it again
to return to the Editable Grid Configuration (or simply use the Interface Hierarchy to
navigate there).
2. Under Rows, click the Add Item button. A row is added to the list. However, you will
notice that the live view of the grid is now giving an error message. This is because the
row must be configured with the number of components that match header cells. We will
set up the structure of our rows next.
3. Click the Row link. In the new screen, click List of Components under the Contents
heading:
4. You will see Add Component. We need to add the components to our row to match the
number of components in the header row. Click Add Component. You will notice that
the Add Component dialog box contains an extensive list of options. Now we will need
to choose the right option for each row component. Add 6 components, configuring each
as follows:
1. Click the Up Arrow to return to the Row configuration, and click the Edit as Expression
button:
2. Fold the grid row layout by clicking the arrow next to line 1. Press Enter to add a new
line at the start, and type a!forEach. Allow the autocomplete to insert the function, and
then delete the closing parenthesis. Re-add it after the folded grid layout:
3. Press the Up Arrow to return to the end of the first line, and press Enter to add a line.
On line 2, type item, and press Enter to accept the items keyword suggestion. After the
auto-filled colon, type ri!items ( accept the autocomplete suggestion when prompted).
4. Add a comma after ri!items, and press Enter to start a new line.
Configure the Display and Save Into Fields for Each Row Component
Now we will need to drill deeper into the grid to configure the Display and Save Into fields for
each component. To do so, we will need to navigate to the configuration pane located under
Contents in the Editable Grid. To navigate to the correct screen quickly, open up the Interface
Hierarchy, and click Contents under forEach. Notice that the Contents pane with the list of
components will appear to the left from the Interface Hierarchy:
1. Click Text to access the configuration options for this component. Change the label to
Description.
● Click the Edit as Expression button next to the Display Value field. We will
need to configure the display value for this field using the function variable
● Configure the Save Input To field using the same method. Click Edit as
Expression, and type fv!item.description.
● Scroll down, and check the Required box. It will make the description required
for each item users add to the list:
2. Click the Up Arrow to return to the list of components in our row.
4. Click to access the Integer Component. Change the label to Qty Using the Edit as
Expression button for each field, configure the fields as follow:
5. Click to access the Decimal Component. Change the label to Unit Price. Using the Edit
as Expression button for each field, configure the fields as follow:
6. Click to access the Text Component. Change the label to Amount. Using the Edit as
Expression button for each field, configure the fields as follow:
● Display Value for the Amount will be based on a calculation. We will use an
expression to calculate it. The expression will be quantity multiplied by unit price,
but the calculation will take place only if quantity and unit price values are
available.
if(
or(isnull(fv!item.qty), isnull(fv!item.unitPrice)),
0,
tointeger(fv!item.qty) * todecimal(fv!item.unitPrice)
)
We have configured the components needed to display the rows of the editable grid. Next, we
will build a clickable link that will enable users to add new rows to the Purchase Request table.
Follow the steps below to build the link:
1. From the Interface Hierarchy, select the Items node in the Editable Grid to display the
properties of the grid:
3. You will see a Dynamic Link added to the interface. In the Configuration Pane, click the
Dynamic Link under the Add Row Link heading to access the configurations for this
item. Configure the link as follows:
● For the Save Value To field, click the Edit as Expression button. Enter the
following expression:
So far, we have configured each row and allowed users to add items to the grid. Next, we will
build a button that will enable users to delete unwanted items. We have reserved the last
column in the grid for this purpose. Let’s configure this column to display a red X button. Follow
the steps below to build the button:
1. In the Interface Hierarchy, once again click the Contents node for the editable grid rows.
You will see the components of each row. We have configured the first five components.
Now we have to configure the last Rich Text component. Click Rich Text to access the
configurations for this component.
2. To configure the Delete button, scroll down to the Display Value in the configuration
Pane. Click the Icon button:
3. After you click Icon, the Search field will display. Type Times into Search, and select
the X. Click Insert.
6. In the Configuration Pane for the Styled Icon component, type Delete Row Button. In
the Alternative Text field. Under the Link heading, click Select Link:
7. After you click Select Link, you will be presented with the list of options. Select
Dynamic Link, and in the Configuration Pane click Dynamic Link to drill into the
configuration options.
As you type this expression, make sure to once again pay attention to the
Documentation Wizard. It will provide insight into what a!save () and remove ()
functions do. Essentially, with this expression we are telling Appian to update our
existing information (or rule input values ri!items) by removing a row (fv!index).
9. Test out the Delete button. Add a new item to the grid, and then remove it by clicking the
red X button!
Now that you’ve learned how to work with Editable Grids, how would you go about adding a
new row to the grid with the total sum for all office supply items? Use the tips below to add
and configure this additional row. We even provide the expression to calculate the sum value
below!
Hint: Use the Interface Hierarchy to locate the Editable Grid component, and use the Add
Item button to add a row. Within the row, add 6 items (each of the Text type). Configure the
Display Values for items 4 and 5 by clicking Edit as Expression. For column 4, type “Total.”
For column 5, use the following expression:
dollar(sum(a!forEach(
items: ri!purchaseRequest.items,
expression: tointeger(fv!item.qty) * todecimal(fv!item.unitPrice)
)))
Use the Documentation Wizard to study this expression. Configure all cells in the row to be
Read-only.
At this point, you should have a better understanding of the steps required to build an Editable
Grid with the dynamic Add and Delete buttons. Before you advance any further, skim through
the topics below. If any of these topics still seem fuzzy, review the steps in the exercise, and
build the interface once again, paying attention to the a!forEach looping function, configuration
of nested elements using the fv!item, and the set-up of dynamic links.
● Use rule inputs and local variables to accept values from the user
● Use the a!forEach looping function and fv!item variable to configure and reference the
components of a row in an Editable Grid
● Use the a!save, append, and remove functions to teach Appian how to update rule
input values by either adding or removing the rows of information
● Access the Interface Hierarchy pane for the panoramic view and quicker access to the
interface components
● Use expressions to define the values of calculated fields