Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update expression-methods-actions.md #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions expression-methods-actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,6 @@ Departure date: 2019-02-02
Departure time: 21:40
Arrival time: 09:05
```
{: screen}

#### JSON templates
{: #join-to-array-object-template}
Expand All @@ -918,11 +917,33 @@ In this example, a template is defined as a JSON object that extracts flight det
"departure": "Flight %e.flight% departs on %e.departure_date% at %e.departure_time%.",
"arrival": "Flight %e.flight% arrives on %e.arrival_date% at %e.arrival_time%."
}
```
{: codeblock}

Using this template, the `joinToArray()` method returns a new array of objects with the specified structure.

1. Define the JSON template in a session variable named Template.
2. Use the joinToArray() method with the template variable:
${Flight_data}.joinToArray(${Template})

At runtime, the response would look like this:
Flight number: AZ1040
Airline: Alitalia
Departure date: 2019-02-02
Departure time: 16:45
Arrival time: 07:00

Flight number: DL1710
Airline: Delta
Departure date: 2019-02-02
Departure time: 07:00
Arrival time: 10:19

Flight number: VS4379
Airline: Virgin Atlantic
Departure date: 2019-02-02
Departure time: 21:40
Arrival time: 09:05


### `Array.remove(Integer index)`
{: #expression-methods-actions-arrays-remove}

Expand Down