0% found this document useful (0 votes)
8 views

Use Array Functions Exercise

This document is a tutorial on using array functions in Appian, including exercises for inserting, removing, and appending arrays, as well as flattening arrays. It provides step-by-step instructions for completing practice exercises, along with additional resources for learning. The document emphasizes the importance of saving work frequently and using proper naming conventions in the Appian Community Edition environment.

Uploaded by

inspire04172024
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Use Array Functions Exercise

This document is a tutorial on using array functions in Appian, including exercises for inserting, removing, and appending arrays, as well as flattening arrays. It provides step-by-step instructions for completing practice exercises, along with additional resources for learning. The document emphasizes the importance of saving work frequently and using proper naming conventions in the Appian Community Edition environment.

Uploaded by

inspire04172024
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Use Array Functions Exercise

Advanced Expressions

Introduction 2
How to Complete the Exercises in this Tutorial 2
How Can I Practice? 2
Appian Version 2
Naming Conventions 2
Save Often 3
Additional Resources 3
Practice 1 Set Up: Insert, Remove, and Append Arrays 4
Practice 1 Help and Resources: Insert, Remove, and Append Arrays 5
Write an expression to remove “yellow” from the array 5
Insert the value “purple” between “red” and “yellow” in the original array 5
Add two arrays to the original array (option 1) 6
Add two arrays to the original array (option 2) 6
Additional Resources 7
Practice 2 Set Up: Flatten Arrays 7
Practice 2 Help and Resources: Flatten Arrays 8
Flatten Arrays 8
Additional Resources 8

© Appian Corporation, 2024


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].

Introduction
How to Complete the Exercises in this Tutorial
Follow the steps to complete practice 1 and 2.

How Can I Practice?


You should practice in Appian Community Edition. This free, community Appian resource
comes with the pre-built Acme Auto application that contains objects that you’ll use to build
your expression rules.

Keep in mind that this is a community environment not suitable for production workloads or
sensitive information.

Appian Version
Appian Community Edition is on the latest Appian version. If you are following the exercises
from a previous Appian version, go to academy.appian.com to download the latest version.

Naming Conventions
When you register for Appian Community Edition, you gain access to a workspace, which is
your personal area within the community environment. When your workspace has been
assigned, you will receive a confirmation email with a workspace ID.

Use this workspace ID when creating new applications and objects. Otherwise, you could run
into naming conflicts with objects created by other users. Pre-loaded apps in your workspace
also include the workspace ID. In the example below, the application prefix for the Acme
Auto Solution app is W0000AS. So, the workspace identifier is W0000, which would be
included in any new app’s prefix.

24.3

© Appian Corporation, 2024 2


Save Often
Appian does not automatically save updates, so save your objects frequently.

Additional Resources
Appian provides a number of training resources for Appian developers. The following
resources are particularly popular with our learners:

● Academy Online - Appian’s online courses provide useful survey courses, step-by-step
tutorials, and practice exercises. Explore these resources at your own pace. Survey
courses will help you develop a better grasp of the topics you need to learn. Video
and print tutorials will help you with getting hands-on experience with Appian.

● Community Discussions for New Users - Check out the New to Appian thread in
Community. Join our community of experts to ask questions and find answers from
past discussions.

● Appian Documentation - Appian’s product documentation will provide you with an


overview of key Appian features, newest release information, additional tutorials,
and helpful patterns and recipes to implement in your app.

24.3

© Appian Corporation, 2024 3


Practice 1 Set Up: Insert, Remove, and Append Arrays
In this lesson you’ll use the expression editor to change the values in an array.

1. In Appian Designer, create a new expression rule.

● Name: Enter W#AE_UseArrayFunctions

● Description: Enter Practice using array functions.

2. Copy and paste the following into the expression editor:

● {"red", "yellow", "blue"}

3. Click Save Changes

Help

For each of the exercises below, use one of the following functions: insert(),
append(), remove(), or a!update()

4. Write an expression to remove “yellow” from the array.

● After editing the expression, click Test Rule to verify the results are correct:
{"red", "blue"}

5. Now replace the current expression with a function that inserts the value “purple”
between “red” and “yellow” in the original array.

● After editing the expression, click Test Rule to verify the results are correct:
{"red", "purple", "yellow", "blue"}

6. Now for the third exercise, replace the current expression with a function that adds
the following two arrays to the original array: {“green”, “purple”}, {“orange”, “gold”}

● After editing the expression, click Test Rule to verify the results are correct:
{"red", "yellow", "blue", "green", "purple", "orange", "gold"}

24.3

© Appian Corporation, 2024 4


Practice 1 Help and Resources: Insert, Remove, and
Append Arrays
Review what your expressions should look like. Also, check out the listed resources to learn
more about indexing values in an array.

Write an expression to remove “yellow” from the array


1. Use the remove function
2. Add array: { "red", "white", "blue" }
3. Add 2 as the index

Insert the value “purple” between “red” and “yellow” in the original
array
1. Use the insert function
2. Add array: { "red", "yellow", "blue" }
3. Add "purple" as the value to insert
4. Add 2 as the index

24.3

© Appian Corporation, 2024 5


Add two arrays to the original array (option 1)
1. Use the append function
2. Add array: { "red", "yellow", "blue" }
3. Add array: { "green", "purple" }
4. Add array: { "orange", "gold" }

Add two arrays to the original array (option 2)


1. Use the update function
2. For the data parameter, add array: { "red", "white", "blue" }
3. For the index parameter, add: { 4, 5, 6, 7 }
4. For the value parameter, add: { { "green", "purple" }, {"orange",
"gold"} }

24.3

© Appian Corporation, 2024 6


Additional Resources
● All functions documentation
○ remove()
○ insert()
○ append()
○ a!update()

Practice 2 Set Up: Flatten Arrays


In this lesson you’ll use the expression editor to convert an array that contains other arrays
into an array of single items.

1. In Appian Designer, create a new expression rule.

● Name: Enter W#AE_FlattenArrays

● Description: Enter Practice flattening arrays.

2. Copy and paste the following into the expression editor:

● a!forEach( items: { 1, 2, 3 },expression: enumerate(fv!item))

■ Use the Format icon to make the expression easier to work with

3. Click TEST RULE to return 3 separate arrays

4. Apply a!flatten() to return a single array

24.3

© Appian Corporation, 2024 7


Practice 2 Help and Resources: Flatten Arrays
Review what your expressions should look like. Also, check out the listed resources to learn
more about indexing values in an array.

Flatten Arrays
1. Collapse the a!forEach() function
2. Add the a!flatten() function around a!forEach

Additional Resources
● All functions documentation
○ flatten()

24.3

© Appian Corporation, 2024 8

You might also like