필드 편집(Set)
n8n v2.34요약
Edit Fields 노드를 사용하여 워크플로 데이터를 설정합니다. Edit Fields 노드에서 사용할 수 있는 설정 및 옵션입니다. GUI를 사용해 필드를 편집하려면 Manual Mapping을, n8n이 입력 데이터에 추가할 JSON을 작성하려면 JSON Output을 사용할 수 있습니다.
Edit Fields 노드를 사용하여 워크플로 데이터를 설정합니다. 이 노드는 새로운 데이터를 설정할 뿐만 아니라 이미 존재하는 데이터를 덮어쓸 수도 있습니다. 이 노드는 Google Sheets나 데이터베이스에 값을 삽입할 때와 같이 이전 노드에서 들어오는 데이터를 예상하는 워크플로에서 매우 중요합니다.
노드 매개변수#
Edit Fields 노드에서 사용할 수 있는 설정 및 옵션입니다.
모드#
GUI를 사용해 필드를 편집하려면 Manual Mapping을, n8n이 입력 데이터에 추가할 JSON을 작성하려면 JSON Output을 사용할 수 있습니다.
설정할 필드#
Mode > Manual Mapping을 선택하면 INPUT에서 값을 드래그 앤 드롭하여 필드를 구성할 수 있습니다.
값을 드래그할 때의 기본 동작은 다음과 같습니다.
- n8n이 값의 이름을 필드 이름으로 설정합니다.
- 필드 값에는 해당 값에 접근하는 표현식이 포함됩니다.
표현식을 사용하고 싶지 않다면:
- 필드 위에 마우스를 올립니다. n8n이 Fixed | Expressions 토글을 표시합니다.
- Fixed를 선택합니다.
필드의 이름과 값 모두에 대해 이 작업을 수행할 수 있습니다.
.gif)
설정된 필드만 유지#
이 옵션을 활성화하면 Fields to Set에서 사용하지 않는 입력 데이터를 모두 폐기합니다.
출력에 포함#
노드의 출력 데이터에 포함할 입력 데이터를 선택합니다.
노드 옵션#
이 옵션들을 사용하여 노드의 동작을 사용자 지정합니다.
바이너리 데이터 포함#
입력 데이터에 바이너리 데이터가 포함된 경우, Edit Fields 노드의 출력 데이터에 이를 포함할지 여부를 선택합니다.
타입 변환 오류 무시#
Manual Mapping에만 해당합니다.
이 옵션을 활성화하면 필드를 매핑할 때 발생하는 일부 데이터 타입 오류를 n8n이 무시하도록 허용합니다.
점 표기법 지원#
n8n은 기본적으로 점 표기법(dot notation)을 지원합니다.
예를 들어, 수동 매핑을 사용할 때 노드는 Name 필드에 대해 점 표기법을 따릅니다. 즉, Name 필드에 이름을 number.one으로 설정하고 Value 필드에 값을 20으로 설정하면 결과 JSON은 다음과 같습니다.
{ "number": { "one": 20} }
Add Option > Support Dot Notation을 선택하고 Dot Notion 필드를 off로 설정하면 이 동작을 방지할 수 있습니다. 이제 결과 JSON은 다음과 같습니다.
{ "number.one": 20 }
템플릿 및 예제#
Edit Fields (Set) 통합 템플릿 둘러보기 또는 모든 템플릿 검색
JSON 출력 모드에서의 배열 및 표현식#
JSON Output을 작성할 때 배열과 표현식을 사용할 수 있습니다.
예를 들어, Customer Datastore 노드에서 생성된 다음 입력 데이터가 있다고 가정합니다.
[
{
"id": "23423532",
"name": "Jay Gatsby",
"email": "gatsby@west-egg.com",
"notes": "Keeps asking about a green light??",
"country": "US",
"created": "1925-04-10"
},
{
"id": "23423533",
"name": "José Arcadio Buendía",
"email": "jab@macondo.co",
"notes": "Lots of people named after him. Very confusing",
"country": "CO",
"created": "1967-05-05"
},
{
"id": "23423534",
"name": "Max Sendak",
"email": "info@in-and-out-of-weeks.org",
"notes": "Keeps rolling his terrible eyes",
"country": "US",
"created": "1963-04-09"
},
{
"id": "23423535",
"name": "Zaphod Beeblebrox",
"email": "captain@heartofgold.com",
"notes": "Felt like I was talking to more than one person",
"country": null,
"created": "1979-10-12"
},
{
"id": "23423536",
"name": "Edmund Pevensie",
"email": "edmund@narnia.gov",
"notes": "Passionate sailor",
"country": "UK",
"created": "1950-10-16"
}
]
Include in Output을 All Input Fields로 설정한 상태에서 JSON Output 필드에 다음 JSON을 추가합니다.
{
"newKey": "new value",
"array": [{{ $json.id }},"{{ $json.name }}"],
"object": {
"innerKey1": "new value",
"innerKey2": "{{ $json.id }}",
"innerKey3": "{{ $json.name }}",
}
}
다음과 같은 출력을 얻게 됩니다.
[
{
"id": "23423532",
"name": "Jay Gatsby",
"email": "gatsby@west-egg.com",
"notes": "Keeps asking about a green light??",
"country": "US",
"created": "1925-04-10",
"newKey": "new value",
"array": [
23423532,
"Jay Gatsby"
],
"object": {
"innerKey1": "new value",
"innerKey2": "23423532",
"innerKey3": "Jay Gatsby"
}
},
{
"id": "23423533",
"name": "José Arcadio Buendía",
"email": "jab@macondo.co",
"notes": "Lots of people named after him. Very confusing",
"country": "CO",
"created": "1967-05-05",
"newKey": "new value",
"array": [
23423533,
"José Arcadio Buendía"
],
"object": {
"innerKey1": "new value",
"innerKey2": "23423533",
"innerKey3": "José Arcadio Buendía"
}
},
{
"id": "23423534",
"name": "Max Sendak",
"email": "info@in-and-out-of-weeks.org",
"notes": "Keeps rolling his terrible eyes",
"country": "US",
"created": "1963-04-09",
"newKey": "new value",
"array": [
23423534,
"Max Sendak"
],
"object": {
"innerKey1": "new value",
"innerKey2": "23423534",
"innerKey3": "Max Sendak"
}
},
{
"id": "23423535",
"name": "Zaphod Beeblebrox",
"email": "captain@heartofgold.com",
"notes": "Felt like I was talking to more than one person",
"country": null,
"created": "1979-10-12",
"newKey": "new value",
"array": [
23423535,
"Zaphod Beeblebrox"
],
"object": {
"innerKey1": "new value",
"innerKey2": "23423535",
"innerKey3": "Zaphod Beeblebrox"
}
},
{
"id": "23423536",
"name": "Edmund Pevensie",
"email": "edmund@narnia.gov",
"notes": "Passionate sailor",
"country": "UK",
"created": "1950-10-16",
"newKey": "new value",
"array": [
23423536,
"Edmund Pevensie"
],
"object": {
"innerKey1": "new value",
"innerKey2": "23423536",
"innerKey3": "Edmund Pevensie"
}
}
]