0% found this document useful (0 votes)
16 views10 pages

Cast Values To Different Data Types Exercise

appian casting

Uploaded by

nauali777
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views10 pages

Cast Values To Different Data Types Exercise

appian casting

Uploaded by

nauali777
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Cast Values to Different Data Types

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: Cast Values to Different Data Types 4
Practice 1 Help and Resources: Cast Values to Different Data Types 8
Casting Results 8

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

© Appian Corporation, 2024


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

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: Cast Values to Different Data Types
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_CastingPractice

● Description: Enter Practice casting values to different data


types.

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

a!localVariables(

/*Convert to Text*/

/*Convert to Boolean*/

local!integer: 100,

/*Cast to Text*/

local!array: {100,200},

/*Cast to Map*/

local!dictionary: {id:1, type: "online"},

/*Convert to Integer*/

local!boolean: true,

/*Cast to Date in 2 ways*/

local!date: {"1/10/21", "2/20/20"},

/*Cast to User*/

24.3

© Appian Corporation, 2024 4


local!user: "admin.user",

},

Tip

Be sure to copy the entire expression, including the last parenthesis and the
empty brackets.

24.3

© Appian Corporation, 2024 5


3. There are 6 local variables that need either a conversion function or the cast()
function. The directions are in the form of comments above each variable that needs
to be converted.

4. Starting on Line 22, enter the conversion function or cast() function to convert each
variable.

● For example, the first expression, which converts local!integer to a text string
is shown in the following figure.

● Hint: use the cast() function for variables where the instruction uses the word
“cast”; use conversion functions for the other variables

● Reference the Appian docs page for conversion functions to help you complete
the exercise

5. Click Test Rule as you go to verify you’ve chosen the correct function and configured it
correctly.

6. Be sure to save your changes!

24.3

© Appian Corporation, 2024 6


7. Bonus Challenge: After you finish adding expressions, use the cast() function to
convert your entire answer to a map data type.

24.3

© Appian Corporation, 2024 7


Practice 1 Help and Resources: Cast Values to
Different Data Types
Review what your expressions should look like. Also, check out the listed resources to learn
more about indexing values in an array.

Casting Results
1. Cast each of the 6 examples
2. Cast the entire array of cast values to a map

3. If you still need help, copy and paste the following expression into the editor:

a!localVariables(

/*Convert to Text*/

/*Convert to Boolean*/

local!integer: 100,

/*Cast to Text*/

24.3

© Appian Corporation, 2024 8


local!array: {100,200},

/*Cast to Map*/

local!dictionary: {id:1, type: "online"},

/*Convert to Integer*/

local!boolean: true,

/*Cast to Date in 2 ways*/

local!date: {"1/10/21","2/20/20"},

/*Cast to User*/

local!user: "admin.user",

/*Answer Key*/

cast('type!{http://www.appian.com/ae/types/2009}Map',

string: tostring(local!integer),

boolean: toboolean(local!integer),

dictToMap: cast(typeof(a!map()),local!dictionary),

arrayToString: tostring(local!array),

booleanToInteger: tointeger(local!boolean),

date:todate(local!date),

dateUsingCast:
cast('type!{http://www.appian.com/ae/types/2009}Date',local!date),

24.3

© Appian Corporation, 2024 9


user:
cast('type!{http://www.appian.com/ae/types/2009}User',local!user)

24.3

© Appian Corporation, 2024


10

You might also like