이 페이지에서: 조건부 규칙을 사용하여 중첩된 프로필 배열을 반복하는 개인화 사용 사례를 따라 픽업 또는 회수할 준비가 된 상태 계획 전자 메일 목록 처방전을 작성하십시오.
프로필에는 상태 플랜이 포함되어 있으며 각 플랜에는 처방이 포함됩니다. 처방에는 “준비됨”, “회수” 또는 "수거"와 같이 다양한 상태가 있습니다.
이 사용 사례에서는 수령하거나 회수할 준비가 된 모든 처방전을 포함하여 각 프로필에 하나의 이메일을 보내려고 합니다. 이 사용 사례를 구현하는 데 사용할 구문에 대한 자세한 내용을 보려면 아래의 각 탭을 클릭하십시오.
안녕하세요, John Doe 님,
다음은 수령할 준비가 되었거나 회수된 처방전입니다.
상태 관리 계획 A
- 처방전 ID: pres1
이름: 약물 A
상태: 준비 - 처방 ID: pres2
이름: 약물 B
상태: 회수
상태 관리 계획 B
- 처방전 ID: pres4
이름: 약물 D
상태: 준비
| code language-html |
|---|
|
| code language-javascript |
|---|
|
This section contains structured knowledge intended to support interpretation, retrieval, and question answering related to this topic.
For complete understanding, this information should be combined with the documentation on this page. Neither source is intended to stand alone; the page describes the feature, while this section provides additional context that helps disambiguate terminology, intent, applicability, and constraints.
- TL;DR: This page demonstrates a complete personalization use case: iterating over nested profile arrays (health plans containing prescriptions) with conditional filtering to display only prescriptions in “ready” or “recall” states in an email.
Intents:
- See a rendered output example of a personalized health plan email
- Understand the HTML template using nested
{{#each}}and{%#if%}blocks for conditional array iteration - Understand the required profile data structure: a
plansarray where each plan contains aprescriptionsarray withstatefields
Glossary:
- Nested iteration: Using
{{#each}}loops inside other{{#each}}loops to traverse multi-level array structures in profile data (e.g., plans → prescriptions). - Prescription state: A field on each prescription object indicating its lifecycle status in this use case — values used are “ready”, “recall”, and “picked up”. (use-case specific)
{%#if%}/{%/if%}: Conditional block syntax used within message templates to filter array items during iteration (distinct from the double-curly{{#if}}Handlebars syntax).
Terminology:
- Canonical name: nested array iteration — variants: nested loops, nested each, multi-level iteration
- Do not confuse:
{{#each}}/{{/each}}(Handlebars iteration syntax, double curly braces) ≠{%#if%}/{%/if%}(conditional syntax, percent-curly braces) — both are used together in this template - Do not confuse: “ready” (prescription available for pickup) ≠ “recall” (prescription has been recalled) ≠ “picked up” (prescription already collected — excluded from the output by the conditional filter)
FAQ:
- Q: Which prescription states are included in the email output? — Only prescriptions with state “ready” or “recall” are displayed. Prescriptions with state “picked up” are excluded by the
{%#if prescription.state = "ready" or prescription.state = "recall"%}conditional filter. - Q: What profile data structure is required for this use case? — A profile with a
plansarray, where each plan object contains aprescriptionsarray. Each prescription object must haveprescription_id,name, andstatefields. - Q: How are plans and prescriptions iterated in the template? — The outer
{{#each profile.plans as |plan|}}loop iterates over each health plan. Inside it,{{#each plan.prescriptions as |prescription|}}iterates over each plan’s prescriptions, and a conditional block filters to only “ready” or “recall” states.