Skip to content

survey_version_question_visibility_targets

Overview

The choices to hide when a visibility rule's conditions hold.

Table Definition

Logical name Physical name Column Type PK Relation Unique Nullable Default Notes
Hide target survey_version_question_visibility_targets id uuid โ—ฏ gen_random_uuid()
visibility_rule_id uuid survey_version_question_visibility_rules:id (cascade)
target_label varchar(255) Label of the choice to hide. Referenced by label, not by ID
target_axis question_option_axis โ—ฏ row / column, distinguishing matrix rows from columns. null = an ordinary choice
target_sub_question_index integer โ—ฏ Position of the target sub-question. null = no sub-questions
sort_order integer Position within the rule
created_at timestamptz now()

Relations

  • visibility_rule_id โ†’ survey_version_question_visibility_rules.id (onDelete: cascade)

Indexes

  • Primary key (id)
  • UNIQUE INDEX: visibility_targets_rule_order_idx (visibility_rule_id, sort_order)

Notes

  • Why labels are used: choices (survey_version_question_options) are deleted and recreated on every question update, so their IDs are not stable. Like conditions, targets are referenced by label string
  • Hide targets refer to the choices of the question the rule itself belongs to (the condition source may be a different question)
  • Example: "If Q1 includes 'Male', hide the choice 'products for women' in this question"
  • In CS this is a visibility_targets[] list of answer_item_ids to hide. When pushing, labels are resolved to CS answer_item_ids
  • Hiding a matrix column cannot be converted to CS, so the extension emits a warning