0% found this document useful (0 votes)
3 views7 pages

SkillsPractice4 LoopingFunctions Solutions

The document outlines two exercises focused on creating and managing skills and ratings using expression rules and interfaces. Exercise 1 involves creating a list of skills with ratings using various functions, while Exercise 2 emphasizes using nested apply statements to manage skill images and validations. Both exercises require the implementation of specific rules and functions to ensure proper data handling and user input validation.

Uploaded by

Kumar M
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)
3 views7 pages

SkillsPractice4 LoopingFunctions Solutions

The document outlines two exercises focused on creating and managing skills and ratings using expression rules and interfaces. Exercise 1 involves creating a list of skills with ratings using various functions, while Exercise 2 emphasizes using nested apply statements to manage skill images and validations. Both exercises require the implementation of specific rules and functions to ensure proper data handling and user input validation.

Uploaded by

Kumar M
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

LOOPING FUNCTIONS - SOLUTIONS

Exercise 1: Create a list of Skills and their ratings

Step-by-Step
1. Create an expression rule called D202 Ex4_1
2. The rule should have two inputs: “category” (text array) and “rating” (integer array)
3. Use the apply, concat, and merge functions to join the two lists together.
a. Between each skill, you should also concatenate “:” which can be achieved by using the
repeat function.
b. After each rating, you should also concatenate a carriage return using the the repeat function.
Hint: A carriage return is represented by the expression char(10).
c. In order to concatenate the objects in the correct order, use fn!concat as the array function
and merge to combine the lists together.

4. After joining the lists of skills and ratings, combine all of the arrays into a single function using the
reduce function.
a. The reduce function should also use fn!concat to combine all lists together.

1
2
Exercise 2: Using nested apply() statements

1. Create a constant called D202_SKILL_IMAGES to keep all of the icon text values.
a. Make sure the constant is an array and add the following values:
“CLOCK”;”FILE_CABINET”;””HANDSHAKE”;”MUSIC_NOTE” Note: The case of the values
must exactly match the values above.

2. Create a supporting rule to test whether each value is less than 3, equal to 3, or greater than 3.
a. Create a new expression rule called D202_ColorRating and add a rule input for “value”
b. Use nested if() statements to check the value. Less than 3 should return “RED”; equal to 3
should return “GREY”; greater than 3 should return “GREEN”.

3
3. Create a new interface called D202_Ex4_2 and add inputs for “punctual”, “organized”, “trustworthy”,
and “creative” (all should be integers).
a. Create a form layout within the interface and define radio button fields for each of the skills.
Configure for each radio button field:
i. Set the label to the name of the skill
ii. Save the value into the corresponding rule input.
iii. Define the choice labels and choice values to use values from 1-5. Hint: You can
either hard-code values for 1-5 or use the enumerate function.

4
4. Add an image field to display the list of documents. This field will require nesting of several array
functions. Hint: It is easiest to build from the top level array first. Find which data type is expected
within that array, and keep going until you get down to the final components. Also, if you are having
trouble getting the image field to work correctly, try in another interface first and use an array of
ratings such as {1,5,2,3}.
a. Start by using apply() with the a!documentImage() function. This will allow you to display
multiple document images.
b. The documents used in the a!documentImage() function can be built using another apply
function. This apply() should use the a!iconNewsEvent function.
i. The a!iconNewsEvent function is expecting two inputs: the name of the icon and the
color. To add two inputs to this apply function, you must use a merge() to merge the
two lists together.
ii. The first input of the merge will come from your constant D202_SKILL_IMAGES.
iii. The second input will be determined using your rule for D202_ColorRating. Since this
is a rule applied multiple times, the list of colors must be defined with one more
apply() function. Use the rule shown as the first parameter of the array and add all of
the rule inputs into an array for the second parameter using brackets {}.

5
5. Once you create the images, add a validation for the form to make sure a value is provided for each
skill. Instead of adding a validation for each skill individually, add a validation for the form to make
sure all fields have a value.
a. Use an if() statement to define the validation. The error message should display, “Please
make sure all skill ratings have been entered”.
b. Use any() to check if any of the fields have a null value.

6
7

You might also like