EQDS Converter Logo ← Back to Converter

Instruction Patterns Guide

All metadata instructions the EQDS Word to XLSForm Converter can automatically detect and convert to valid XLSForm syntax.

πŸ“ How to Write Instructions

πŸ“– Section 1: Overview

1.1 How Instructions Are Written

Every metadata instruction appears as a paragraph above the question table:

Relevance: Display if DEM1 = 01
Constraint: Do not proceed if number > 65
Choice filter: Display options selected at WHL2a

1.2 Question Code Prefixes

Stripped automatically: Que. / Ques. / Q. / Question

1.3 Case Sensitivity

All triggers are case-insensitive. DISPLAY IF, display if, and Display If all produce identical results.

1.4 Leading Zeros

Handled automatically. 01, 1, '01', and "01" all produce the same result.

1.5 Targeting Specific Questions

Use For [Q], ... to direct an instruction at a specific question:

For HOB3b, display options selected at HOB3a
Display STK4bai, STK4baii and STK4baiii if 01 is selected at OOP2eiv

1.6 {} Reference Calls

Use {} in a question label to display the label text of an option selected at another question:

{reference option label selected at OM3a}
{option selected at OM3a}
β†’ both produce ${OM3a_label}

Parentheses () are never treated as reference calls.

1.7 Question Code Rules

Every non-note question must begin with a unique code followed by a full-stop:

DEM1. What is your name? ← correct
What is your name? ← error: missing code

1.8 Group Hierarchy

Four nesting levels: Section β†’ Subsection β†’ Subsection Group β†’ Questions

1.9 Open-Ended Grid Input Types

Open ended grid / Text grid β†’ text
Integer grid / Int grid β†’ integer
Decimal grid / Number grid β†’ decimal
Date grid β†’ date

1.10 Bold Hints

Hint text is wrapped in bold markdown (**text**) by default. Can be turned off in the converter UI.

Showing all 71 patterns
# Pattern Trigger Words XLSForm Output Column Notes
EQDS Word to XLSForm Converter β€” By Marvis Onyenwenu Enubiaka

3. Grouped by Column

πŸ“‹ 3.1 Relevant (Patterns 1–24)

  • Equals: Display if / Ask if [Q] = [val]
  • Not equals: Display if / Skip if [Q] != [val]
  • Skip reversal: Skip if shows when condition is FALSE
  • Selected at: Display if [val] is selected at [Q]
  • Multiple values: Display if [Q] = 01 or 02 or 03
  • Two questions: Display if [Q1] = 01 or [Q2] = 01
  • Is answered: Display if [Q] is answered / is not empty
  • Multi-target: Display Q1, Q2, Q3 if [val] is selected at [Q]
  • Count-based: Display if at least [n] options are selected at [Q]
  • Mixed: Display if [Q] = v or [vals] is selected at [Q2]
  • Chained: Display if [vals] is selected at [Q1], or [vals] is selected at [Q2]
  • Combined: Display if DEM1 = 01 and DEM2 is answered

🚫 3.2 Constraint (Patterns 25–49)

  • Do not proceed if [Q] = [val] β€” must NOT equal val
  • Number range: Do not proceed if number > / < / >= / <= [val]
  • Between: Only allow a number between [val1] and [val2]
  • Not selectable: Make [code] not selectable
  • Exclusive: Make [code] Exclusive β€” deselects all others
  • Max selections: Only select [n] options β†’ count-selected(.) <= n
  • Grid sum: Sum of all topics must not exceed / be = / be at least [n]
  • Self-referential: Do not proceed if 01 is not selected (no Q named)
  • Multi-Q: Do not proceed if [Q1] = [v1] or [Q2] = [v2]
  • Mixed: Do not proceed if [Q] = [val] or [vals] is selected at [Q2]
  • Proceed if: Positive constraint β€” keeps conditions as-is
  • Combined: Make 997 exclusive and do not proceed if number > 65

πŸ”½ 3.3 Choice Filter (Patterns 50–58)

  • Triggers: Display options selected at, Filter to, Limit to, Show only options
  • OR between sources always produces union
  • AND with identical labels β†’ intersection
  • AND with different labels β†’ union (auto-detected)
  • Always show: Make [code] always visible β†’ appended as or name = '[code]'
  • Funnel: filter through question funnel β€” Q1 never receives a filter
  • Current item: filter by current item at [Q] β†’ product_group = ${current_item}
  • Use >> group headers in option table to tag choices with product_group

4. Special Instructions

πŸ”— 4.1 Filter Through Question Funnel

Both phrasings accepted: filter through question funnel or filter through funnel

Q1 β†’ no filter
Q2 β†’ selected(${Q1}, name)
Q3 β†’ selected(${Q2}, name)

βš–οΈ 4.2 AND vs OR Between Source Questions

  • OR always produces union
  • AND with identical option labels β†’ intersection
  • AND with different option labels β†’ union (auto-detected by label text)

🎯 4.3 Named Question Targeting

Display IMR6a if IMR3 = 01 or IMR2 = 01 Display STK4bai, STK4baii, STK4baiii if 01 is selected at OOP2eiv

Only named questions get the condition. Unnamed siblings get none.

🏷️ 4.4 Reference Labels in Question Text

{reference option label selected at OM3a}
{option selected at OM3a}
β†’ both produce ${OM3a_label} (label text, not code)

βž• 4.5 Sum Constraint on Grid Questions

Write as a Constraint: instruction above the grid table. Applies to both open-ended grids and single choice grids:

Constraint: Sum of all topics must not exceed 10
Constraint: Sum of all topics must be = 10
Constraint: Sum of all topics must equal 10
Constraint: Sum of all topics must be equal to 10
Constraint: Sum of all topics must be at least 5

Important β€” the = n case: The equality check only fires when all subsequent topics are empty, meaning the current topic is the last one answered. All previous topics only enforce <= n. This correctly handles variable topic counts based on filtered selections β€” if only 3 of 10 topics are shown, the = n check fires on topic 3, not topic 10.

πŸ”’ 4.6 Max Selections Constraint

All produce count-selected(.) <= 5:

Constraint: Only select 5 options
Constraint: Select no more than 5 options
Constraint: Maximum 5 selections

πŸ“Š 4.7 Count-Based Selection Relevance

Form A: Display if at least 2 options are selected at PRV1a
β†’ count-selected(${PRV1a}) >= 2

Form B: Display if options selected at PRV1a > 1
β†’ count-selected(${PRV1a}) > 1

Use 'exactly' for count equality (not '=').

↩️ 4.8 Self-Referential Constraints

No question named β€” applies to the current question (dot operator):

Do not proceed if 01 is not selected β†’ selected(., '1')
Do not proceed if 01 is selected β†’ not(selected(., '1'))
Do not proceed if 01, 02, and 03 is not selected
β†’ selected(.,'1') and selected(.,'2') and selected(.,'3')

πŸ”€ 4.9 Combined Cross-Question Instructions

Pattern A β€” equals + selected-at:
Display if PRV2ci = 01 or 997 or 998 or 999 and 01 is selected at PRV1a

Pattern B β€” chained selected-at:
Display if 01 is selected at PRV2ci, or 997 or 998 or 999 and 01 is selected at PRV1a

Works for both Relevant and Constraint. 'Proceed if' keeps conditions positive.

πŸ” 4.10 Filter by Current Repeat Item

Step 1 β€” Tag choices with >> group headers:

>> Toning cream
Moisturising 01

Step 2 β€” Write the choice filter:

Choice filter: filter by current item at ELI2
β†’ product_group = ${current_item}

...and make 997, 998 always visible
β†’ product_group = ${current_item} or name = '997' or name = '998'

πŸ“ž 4.11 Phone Number and Digit Length

Constraint: Phone number = Nigeria β†’ regex(.,'^...$')
92 countries supported; unknown β†’ [REVIEW]
Constraint: Allow only 11 digits β†’ regex(.,'^[0-9]{11}$')
Constraint: Allow only 10 to 13 digits β†’ regex(.,'^[0-9]{10,13}$')

πŸ”— 4.12 Combined Same-Type Instructions

Constraint: Make 997 exclusive and do not proceed if number > 65 and only select 3 options
β†’ not(selected(.,'997')...) and . <= 65 and count-selected(.) <= 3

Relevant: Display if DEM1 = 01 and DEM2 is answered
β†’ ${DEM1} = '1' and ${DEM2} != ''

Any compatible patterns joined by and/or in one instruction line.

~ 4.13 No-Reference Marker on Options

Prefix any option label with ~ in the Word table:

~None 25
~Packaging doesn't really matter 06
  • Strips ~ from label in choices sheet
  • Excludes code from ${Q_label} calculate
  • Auto-injects not(selected(${Q},'code')) as relevant on any referencing question
  • ANDs onto existing relevant without duplication

Only activates when ~ is explicitly present in the document.

5. Repeat Group Trigger Patterns

The trigger paragraph appears above the first question of the repeat group and always starts with "Repeat group" (case-insensitive).

βš™οΈ 5.1 How Repeat Groups Work

  • Collects all question tables below the trigger until End Repeat Group or a section boundary
  • Uses the Repeat Group Format selected in the converter UI
  • The trigger question's choice list determines which options are iterated

πŸ“ 5.3 Repeat Group Formats

  • Smart Auto-Select (Default): ≀20 options β†’ Brand-Fixed; >20 β†’ Automated
  • Format 1: Sequential Positional Loop β€” fixed slot groups
  • Format 2: Brand-Fixed Conditional Group Loop β€” one fixed group per option
  • Format 3: Automated Selection-Driven Repeat Loop β€” true begin_repeat/end_repeat

πŸ“‹ 5.2 Pattern Reference

# Instruction Pattern Example Notes
1Repeat group for options selected at [Q]Repeat group for options selected at MED1aRepeats for every option selected at Q
2Repeat group for all [Q] optionsRepeat group for all MED1a optionsRepeats for ALL options regardless of selection
3Repeat group for options selected at [Q] but not selected at [Q2]Repeat group for options selected at MED1a but not selected at MED1bOnly options in Q1 but not Q2 (exclusion)
4Repeat group for options selected at [Q] and [Q2]Repeat group for options selected at AWR1 and USE1Only options selected on BOTH Q1 and Q2 (intersection)
5Repeat group for [v1],[v2]... selected at [Q]Repeat group for 01 and 02 selected at MED1aSpecified codes only. Always Brand-Fixed Conditional Group Loop
6Repeat group for [v1],[v2]... selected at [Q] but not selected at [Q2]Repeat group for 01, 03 selected at AWR1 but not selected at USE1Subset + exclusion. Always Brand-Fixed
7Repeat group for [v1],[v2]... selected at [Q] and [Q2]Repeat group for 01, 03 selected at AWR1 and USE1Subset + intersection. Always Brand-Fixed
8Repeat group for [Q] (short form)Repeat group for PRV1aEquivalent to full form. Uses Smart Auto-Select threshold

🎯 5.4 Repeating for Specific Option Codes Only

Repeat group for 01 and 02 selected at MED1a
Repeat group for 01, 02 and 03 selected at MED1a
  • Only the listed codes are used β€” all other selected options are ignored
  • Any number of codes, separated by commas and/or 'and'/'or'
  • Leading zeros handled automatically
  • Subset codes always use Brand-Fixed Conditional Group Loop regardless of option count