What is the correct expression?

Given the array below, a user wants a comma-separated string of all stat names.

What is the correct expression?

A)

B)

C)

D)

A . Option A
B . Option B
C . Option C
D . Option D

Answer: B

Explanation:

Understanding the Requirement:

The input is an array containing objects, and the goal is to extract all the stat.name values into a comma-separated string.

Example Input:

[

{

"base_stat": 48,

"effort": 1,

"stat": {

"name": "hp",

"url": "https://pokeapi.co/api/v2/stat/1/"

}

},

{

"base_stat": 48,

"effort": 0,

"stat": {

"name": "attack",

"url": "https://pokeapi.co/api/v2/stat/2/"

}

}

]

Example Output:

"hp, attack"

Why Option B is Correct:

The expression join(map(2.data: stats[]; stats.stat.name); ", "):

map: Iterates through each object in the array (2.data: stats[]) and extracts the stat.name field.

join: Combines the extracted values into a single string, separated by a comma and space (", ").

Breaking it down:

map(2.data: stats[]; stats.stat.name) → Creates an array of names: ["hp", "attack"].

join(…; ", ") → Converts the array into the string "hp, attack".

Why the Other Options are Incorrect:

Option A: join(2.data: stats[]; stat.name; ", ")

This syntax is incorrect because it attempts to directly access stat.name within the join function without first mapping the values.

Option C: join(map(2.data: stats[]; stat.name); ", ")

The mapping references stat.name directly but does not account for the nested structure (stats.stat.name).

Option D: join(flatten(2.data: stats[]); ", ")

The flatten function is unnecessary here as the data is already structured. It would not properly extract the stat.name values.

Steps to Implement in Workfront Fusion:

Add a Mapping/Transformation Module.

Use the join(map(…)) function as described to transform the input array into a comma-separated string.

Test the output to ensure it correctly generates the desired format.

How This Solves the Problem:

The map function ensures the proper extraction of nested stat.name values. The join function combines these values into the desired format efficiently. Reference and Supporting Documentation:

Adobe Workfront Fusion Functions Documentation

Workfront Community: Using Map and Join Functions

The combination of map and join ensures that the stat names are extracted and formatted into a single comma-separated string, as required.

Latest AD0-E902 Dumps Valid Version with 51 Q&As

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments