Skip to main content

Special Answers in Exports

This page shows how a choice question's None, Refuse to answer, Don't know, and Other answers are written in each export format. Use it to map an Endatix export onto another tool's dataset or codebook. For how to download an export in the Hub, see Exporting Submissions.

Stored values​

SurveyJS stores each special item as a fixed value in the submission. Endatix exports read these values:

ItemStored valueQuestion typesChoosing it clears other choices
OtherotherCheckbox, tag box, radio group, dropdown, image pickerNo
NonenoneCheckbox, tag box, radio group, dropdownYes
Refuse to answerrefusedCheckbox, tag box, radio group, dropdownYes
Don't knowdontknowCheckbox, tag box, radio group, dropdownYes

Select All is never stored: it only ticks the question's other choices, so it has no column or category. A custom choice with isExclusive: true stays an ordinary choice in every export.

note

These are the SurveyJS default values (settings.noneItemValue, settings.refuseItemValue, settings.dontKnowItemValue). Choosing your own export codes for them is tracked in endatix#1544, and storing custom values in endatix#1606.

CSV, JSON, and XLSX​

The Submissions formats write one column per flattened key. The key separator is __ unless the export format sets another keySeparator.

The examples use the native column names and values. An export format with the Crunch alias profile, or with -- as its key separator, writes the Crunch shape instead: columns are renamed Q1, Q1_1, and so on, grouped by question, and a single-select cell holds the choice's codebook id, as in csv-shoji, instead of none or refused.

Multi-select (checkbox, tag box)​

Each choice and each special item gets its own indicator column, in this order: the question's choices, then Other, then None, Refuse to answer, and Don't know. A question that copies its source's Other (see otherFrom below) lists that Other last, after its own None, Refuse to answer and Don't know.

An indicator is 1 when chosen and 0 when not, except where the respondent may not have seen the choice: then the cell is empty (null in JSON). The rules below say when that is.

Conditional choices. choicesVisibleIf applies to every regular choice; visibleIf on a choice applies only to that value. A conditional choice exports as 1 if picked and empty otherwise, even on an answered question.

  • The export reads conditions from the form version the respondent answered, in the question's own loop or at the root. Blank expressions do not hide choices.
  • Removing a condition while keeping its choice allows an unpicked 0. Removing the choice leaves its retained column empty when the merged catalog records that it was conditional.
  • If the version, occurrence or choice is unavailable, the codebook's choiceCatalogs[<question>].conditionalChoices supplies the values kept across merge compiles.
  • Rows with a readable submitted version do not need a recompile. To rewrite stored indicators, an administrator with forms.edit runs a forced backfill for each affected completion scope.

An unanswered question with its own choices (0.9.3). It writes 0 for unconditional choices only in a completed submission and when nothing can hide it. Every column is empty:

  • in an incomplete submission,
  • when the question or an enclosing panel, dynamic panel or page has a visibleIf or a static visible: false,
  • when the form uses its name for two questions,
  • when the submission's form version did not have the question, because it was added later or removed earlier.

The codebook's choiceCatalogs[<question>].canBeHidden is true when any form version compiled since the last replace=true compile could hide it.

A question that copies its choices (choicesFromQuestion, or Hub carry forward). It writes 0 only for a choice the respondent was shown. With mode all, selected or unselected, the copy's shown rule rebuilds the shown choices from the source questions' answers in the same submission, or the same loop item first.

  • A source can copy its choices too (0.9.3). Under selected, the copy shows what that source picked. Under all or unselected, it shows what the source was shown, which the source's own shown rule rebuilds.
  • The codebook's choiceCatalogs[<question>].shown holds the rule: mode, sources with each source's name and values, and whenComplete. It is present only when the shown choices can be rebuilt.
  • whenComplete is set when the copy or a source has a visibleIf, its own or an enclosing panel's, dynamic panel's or page's, or when, under all or unselected, a copied source's own rule has it. The rule then holds only for a completed submission.
  • In a row where the rule holds only for a completed submission and this one is incomplete, every unpicked copied choice is empty. When a source has no answer in the row, an unpicked choice that no other source showed is empty.
  • A copy with no answer is empty in every column.

There is no shown rule, and every unpicked copied choice is empty, when any of these holds:

  • On the copy:
    • an unrecognized mode,
    • edxCarryForwardMaxChoices (Hub carry forward),
    • choicesVisibleIf,
    • a static visible: false on the copy or on an enclosing panel or page.
  • On a source:
    • a ranking,
    • choices loaded from a data list or a URL,
    • choicesVisibleIf or a choice's visibleIf,
    • a source that copies its choices through a chain that does not resolve, such as a cycle or a data list further up,
    • under all or unselected, a source that copies its choices and is not a checkbox or tag box with a shown rule of its own.
  • On the form:
    • a copy or source whose name the form uses twice (at the root and in a loop, or in two loops),
    • a survey that keeps hidden answers (clearInvisibleValues set, and not to onComplete) with a visibleIf on any question, panel or page,
    • a copy or source whose own clearIfInvisible keeps its answer while a visibleIf can hide it,
    • a schema compiled before 0.9.2.

Other and the special items of a copy. These apply to an answered copy.

  • An unpicked Other is 0 when the shown rule holds and either the submission's form version showed the copy's own Other or its source picked Other with text. Otherwise it is empty.
  • When the shown choices can be rebuilt, the copy's own unpicked None, Refuse to answer and Don't know are 0, even when a source has no answer. In an incomplete submission where the rule holds only for a completed one, they are empty too.

Other copied from the source (otherFrom, 0.9.3). A copy of the choices its source picked (choicesFromQuestion with choicesFromQuestionMode: "selected") that shows no Other of its own gets the source's Other: SurveyJS adds it once the source picked it with a text.

  • The copy stores other with no text, so __other_text reads the copy's own non-empty text first, then the source's text, decoded with the submitted version's choices and storage settings.
  • Only if the submitted version is absent or unreadable does the export fall back to that source and its stored catalog. It does not assume the copy showed its own Other.
  • A merge keeps the latest recorded otherFrom, not a history of sources.
  • The indicator rules above still apply.

A loop item the respondent did not have. Every indicator of that item is empty.

Rankings. An unanswered ranking writes an empty cell for every choice; an answered one writes the rank, and 0 for a choice left unranked. A ranking that copies its choices writes an empty cell, not 0, for a choice left unranked.

For a checkbox cb with choices a and b, Other, None, Refuse to answer, and Don't know, a respondent who picks a and Other and types typed gets:

cb__acb__bcb__othercb__other_textcb__nonecb__refusedcb__dontknow
101typed000

In the JSON format, the same row is "cb__none": 0, a number, not a boolean. JSON property names are camel-cased, so a key that starts with a capital letter, such as QCb__none, is written as qCb__none.

Single-select (radio group, dropdown)​

The question's column holds the stored value: a choice value, other, none, refused, or dontknow. The text typed for Other goes in <question>__other_text, whichever way the form stores it:

Stored by SurveyJSrgrg__other_text
"rg": "other" and "rg-Comment": "x"otherx
"rg": "x" (storeOthersAsComment: false)otherx
"rg": { "value": "other", "comment": "x" }otherx
"rg": "none"none
"rg": "refused"refused

Choice comments​

A checkbox, tag box, radio button group, or dropdown gets one text column per choice with showCommentArea: true (0.9.3): brands__item2__comment for choice item2 of brands, brands--item2--comment in csv-shoji, where the Shoji codebook declares it a text variable. The cell holds the comment stored on that picked choice, and is empty for an unpicked choice or a pick without a comment. Other text keeps its own column. Hub tag boxes do not collect choice comments, so their cells stay empty unless an imported answer carries a value and a comment.

The export reads the choice from the submitted form definition. When the definition cannot be read, or the answer could belong to another question type, the row is kept and the comment left blank; when it cannot be loaded, the backfill lists the submission in failedSubmissionIds.

A comment whose header would collide with another column or a Shoji ranking array takes the first free suffix (_2, _3, …), and keeps that header once published. A compile that would give a published header a second meaning returns 409 with errorCode: "ReportingSchemaAliasConflict" and keeps the previous schema (previousSchemaRetained: true). The same code also refuses a merge that cannot match a legacy matrix codebook to a historical definition; detail says which. For a header clash, rename the question or choice named in detail, then compile again.

Answers kept as stored​

Two kinds of question keep the answer in one column as SurveyJS stored it, so a special item appears as its value:

  • A multi-select that loads its choices from a data list or a URL and has no choices on the form: ["none"].
  • A question in a dynamic panel without a loop source: pd__0__pdRg is none.

Questions in a dynamic panel with a loop source flatten like top-level questions, one set of columns per loop item, for example loop__nike__loopCb__dontknow.

Codebook​

The Codebook format exports the form's codebook JSON. Its choiceCatalogs object lists every select question's choices with a numeric id. Special items follow the question's choices and Other. The one exception is a question that copies its source's Other (otherFrom): that Other comes last, after None, Refuse to answer and Don't know, so adding Other alone does not shift the earlier items.

"choiceCatalogs": {
"cb": {
"multiple": true,
"otherStorage": "comment",
"choices": [
{ "value": "a", "id": 1, "text": { "default": "a" } },
{ "value": "b", "id": 2, "text": { "default": "b" } },
{ "value": "other", "id": 3, "kind": "other", "text": { "default": "Other" } },
{ "value": "none", "id": 4, "kind": "none", "exclusive": true, "text": { "default": "None" } },
{ "value": "refused", "id": 5, "kind": "refused", "exclusive": true, "text": { "default": "Refuse to answer" } },
{ "value": "dontknow", "id": 6, "kind": "dontknow", "exclusive": true, "text": { "default": "Don't know" } }
]
}
}
FieldMeaning
multipletrue for checkbox and tag box, false for single-select questions.
otherStorageWhere the Other text is: comment (a separate comment, the SurveyJS default) or value (the text replaces other: storeOthersAsComment: false, or a checkbox whose regular choice shows a comment box, which stores each checked item as an object such as {"value": "x"}). Only on questions with Other.
otherFromThe source's name, on a copy of the choices its source picked that shows no Other of its own, when the source shows Other (0.9.3). See Other copied from the source.
idThe choice's code. A merge compile keeps it when choices are added, removed, or reordered: a new item takes the next free id. A replace compile assigns IDs in current choice order. A form that removed a choice before this rule existed has its later choices renumbered once, in its next Shoji export.
kindother, none, refused, or dontknow for a special item. Absent for an ordinary choice.
exclusivetrue when choosing the item clears the other choices, including a custom isExclusive choice.
textThe label per locale, from the question's otherText, noneText, refuseText, or dontKnowText, or the SurveyJS default label.

Each indicator column in columns names its item with choiceValue and choiceLabel, for example columns["cb__none"].

Crunch Shoji codebook and csv-shoji​

A Crunch.io import takes two files: the Codebook (Shoji) metadata and the csv-shoji data. csv-shoji uses -- as its key separator, so cb__none becomes cb--none.

Single-select​

A radio group or dropdown is a categorical variable. Its categories are the catalog's choices, with the same ids. Refuse to answer and Don't know are missing categories, so Crunch leaves them out of percentages. None is a valid answer.

For a radio group rg with choices a and b and every special item:

idnamemissing
1afalse
2bfalse
3Otherfalse
4Nonefalse
5Refuse to answertrue
6Don't knowtrue

csv-shoji writes the category id in the rg column, so a respondent who refused gets 5. An unanswered question writes an empty cell.

Multi-select​

A checkbox or tag box is a multiple_response variable with one subvariable per choice and special item, such as cb--none. Every subvariable has the categories not selected (id 0) and selected (id 1), and neither is missing: in a multi-select, Refuse to answer and Don't know are selected or not selected like any other choice. csv-shoji writes 1, 0, or an empty cell where the native export is empty, which Crunch imports as No Data.

Other text​

<question>--other_text is a separate text variable, named after the question with -- Other.

Category names​

Crunch needs unique category names in a variable. When a removed choice and a current one share a label, every one but the newest is named with its value, as in Blue (b).

Forms prepared before special items were exported​

A form whose reporting data was prepared before this behavior existed has no special-item columns. Run Rebuild reporting data… once on the form's export panel to add them. The special items take the next free ids after the existing choices.