Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
5 views1 page

SkillsPractice2 MathematicalFunctions

The document provides exercises to develop skills in using date and time functions. It includes tasks such as generating a random boolean value, determining the day of the week from a given date, and converting date/time to ISO format. Each exercise outlines specific steps and functions to be utilized for completion.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

SkillsPractice2 MathematicalFunctions

The document provides exercises to develop skills in using date and time functions. It includes tasks such as generating a random boolean value, determining the day of the week from a given date, and converting date/time to ISO format. Each exercise outlines specific steps and functions to be utilized for completion.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

MATHEMATICAL FUNCTIONS

Work through the following exercises to help develop your skills using date and time functions. Read each
exercise instruction carefully. For exercises that don’t require the creation of a new rule, simply create a new
expression rule called testRule and use it to perform the tasks listed.

Exercise 1: Return a random value of true or false

Return a random number between 0 and 1, round the value, and convert it to a boolean
1. Return a random number using the rand() function.
2. Use the round() function to return either 0 or 1.
3. Convert the value to a boolean using the toboolean() function.

Exercise 2: Return the day of the week of a given date

Based on a selected date, show the corresponding day of the week in 3 day format (e.g. MON, TUE)
1. Create a rule input of data type date.
2. Find the weekday() of the date, which should return a number 1-7.
3. Use displayvalue() to match the number of the weekday to a list of days.
a. Create a constant to store the a list of the following days of the week: SUN, MON, TUE,
WED, THU, FRI, SAT.
b. Use enumerate to return an array of numbers used as the array to match the weekday
number. Hint: Enumerate returns an array of {0,1,...,n-1}, so make sure to add 1 to create an
array of {1,2,...,n}.
c. Use “” as the placeholder value.

Exercise 3: Convert date/time to ISO format


Suppose you have process integration that requires a date to be displayed using the ISO Format. In this
format, 3/24/2016 4:27:05 PM would be displayed as 2016-03-24T16:27:05. Use several date functions to
return the individual components and format the date as necessary for this process. Keep in mind the ISO
Format will display the date as text.
1. Create a rule input of date and time. Hint: You can use now() to test the current date and time.
2. Use the functions year(), month(), day(), hour(), minute(), and second() to return each component
and concatenate them together.
3. The ISO format requires a zero in front of any numbers less than 10, so create a supporting rule that
will check if any values are less than 10 and apply it to each component of this rule.
4. Try using the text function to define the same final result using a different method. Hint: View the
documentation for text functions to see how to return year, month, day, hour, minute, and second:
https://forum.appian.com/suite/help/16.1/Text_Functions.html#text.28.29

You might also like