Skip to content

Commit d1c2644

Browse files
author
Donna-Marie Smith
committed
added additional information
1 parent 7748715 commit d1c2644

File tree

1 file changed

+52
-18
lines changed

1 file changed

+52
-18
lines changed

content/en/docs/2024.9/Reference/Concepts/fundamentals/blocks/block-properties/what-is-a-block-property.md

Lines changed: 52 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -59,28 +59,62 @@ To decompose an output value, the output property will need to be set to an expr
5959

6060
``` json
6161
{
62-
"company": {
63-
"name": "Company Name",
64-
"department": [
65-
{
66-
"name": "HR",
67-
"employees": [
68-
{
69-
"name": "Joe Blogs",
70-
"id": "101"
71-
},
72-
{
73-
"name": "Jane Doe",
74-
"id": "102"
75-
}
76-
]
77-
}
62+
"company": {
63+
"name": "Company Name",
64+
"department": [
65+
{
66+
"name": "HR",
67+
"employees": [
68+
{
69+
"name": "Joe Blogs",
70+
"id": "101"
71+
},
72+
{
73+
"name": "Jane Doe",
74+
"id": "102"
75+
}
7876
]
79-
}
77+
}
78+
]
79+
}
8080
}
8181
```
8282

83-
To decompose this structure and store a part of the value to a variable, e.g. the syntax would be
83+
To decompose this structure and store a part of the value to a variable, e.g. to get the employees for the first department, the syntax would be:
84+
85+
```text
86+
{"$.company.department[0].employees": ($)VariableNameToStore}
87+
```
88+
89+
In this example, this would set the variable to be:
90+
91+
```json
92+
{
93+
{
94+
"name": "Joe Blogs",
95+
"id": "101"
96+
},
97+
{
98+
"name": "Jane Doe",
99+
"id": "102"
100+
}
101+
}
102+
```
103+
104+
To set the variable to the last value `-1` should be used for the index:
105+
106+
```text
107+
{"$.company.department[0].employees[-1]": ($)VariableNameToStore}
108+
```
109+
110+
In this example, this would set the variable to be:
111+
112+
```json
113+
{
114+
"name": "Jane Doe",
115+
"id": "102"
116+
}
117+
```
84118

85119
#### Discarding Outputs
86120

0 commit comments

Comments
 (0)