24.2 Exercise 4 - Expressions
24.2 Exercise 4 - Expressions
Exercise to Accompany
Expressions: Transform Your Data
2 Create an Application
4 Expressions
6 Sites
8 Interfaces 101
11 Reports
12 Task Report
Notice of Rights
This document was created by Appian Corporation, 7950 Jones Branch Dr, Tysons, Virginia 22102.
Copyright 2024 by Appian Corporation. All rights reserved. Information in this document is subject to
change. No part of this document may be reproduced or transmitted in any form by any means, without
prior written permission of Appian Corporation. For more information on obtaining permission for reprints
or excerpts, contact Appian Training at [email protected].
Exercise 4: Expressions
In this exercise, you will create two types of rule objects: six constants and one expression rule.
Create Constants
A constant is a literal value that can be called from any expression, across objects in your
application. In this section, you will create constants that point to the groups and folders you
just created.
1. From within the W#SA Constants folder, click NEW > Constant.
3. Click CREATE.
4. Follow steps 1–3 to create constants for the remaining four groups:
● W#SA Users
● W#SA Supervisors
● W#SA Registrars
● W#SA Mechanics
Next, you will create a constant that points to the W#SA Documents folder.
3. Click CREATE.
1. From within the W#SA Expressions folder, click NEW > Expression Rule.
3. Click CREATE.
4. In the Rule Inputs pane, click the New Rule Input icon.
a!match(
value: ri!user,
whenTrue: isnull(fv!value),
then: "",
whenTrue: isusernametaken(fv!value),
then: proper(
user(fv!value, "firstName") & " " & user(fv!value,
"lastName")
),
default: proper(joinarray(split(fv!value, "."), " "))
)
In this expression, a!match evaluates the input (a username) against multiple conditions
and returns a value (the formatted name) based on a match. Function variables, which
use the domain prefix fv!, are special variables used within certain functions and
interfaces. Here, you are using fv!value to reference the value parameter (ri!user).
● First, this expression checks whether the user’s username is null. If the user’s
username is null, an empty string is returned.
● If the user’s username is not null, then the expression checks whether the user is
an active user. If the user is active, the first and last name associated with the
username is returned.
● If the username is not null and the user is not active, the default is returned.
● The process for formatting users and non-users is different. The last line in the
expression reformats the username input as First and Last Name for a non-user.
Visit the Appian Community YouTube channel and Appian Documentation to learn more
about functions.
Troubleshooting Resources
Stuck on a step, or need help troubleshooting? Appian provides several support resources that
you can use as you build:
1. Acme Auto Solution Application - The Acme Auto Solution Application (AS) is the
solution you are working to build in the Step-by-Steps, so you can use it as a reference
tool. Review this application to see how specific objects are configured, or test the app
to see how the features work from a business user’s perspective. You can find this app
in your Appian Community Edition workspace.