Technisch overzicht

SELECT
 CONCAT('lime_survey_', q.sid) AS table_name,
 CONCAT(q.sid , 'X', q.gid, 'X',
   (CASE WHEN q.parent_qid = 0 THEN q.qid ELSE q.parent_qid END),
   (CASE WHEN q.parent_qid <> 0 THEN q.title ELSE '' END)
 ) AS column_name,
 (grp.group_order * 100000) + (q.question_order * 1000) AS ORD,
 '???' AS column_exists,
 q.question AS DESCR,
 ## Harmonica Question TYPE
 '????' AS HQTYPE,
 (SELECT COUNT(*) FROM `lime_conditions` c 
  WHERE c.qid = q.qid 
  AND c.cfieldname = '{TOKEN:USESLEFT}'
  AND c.method = '=='
  AND c.value = '1') AS 1STTIMEONLY,
 '' AS EXTRA,
 '' AS MEANING_EXTRA,
 (SELECT COUNT(*) FROM `lime_question_attributes` sqa 
  WHERE sqa.qid = q.qid AND sqa.attribute = 'hidden' AND sqa.value = '1') AS HIDDEN,
 grp.group_name,
 q.*
FROM `lime_questions` q
  INNER JOIN `lime_groups` grp
  ON q.sid = grp.sid AND q.gid = grp.gid
WHERE q.sid = 223796 AND q.type NOT IN ('M','R','P','T','O','S','|','Y','L','G','X','!')
## Hierboven komt niets meer uit, als het goed is!
 
UNION 
# Multiple choice subquestions (zowel gewone Multiple Choice antwoorden als MC met commentaar)
SELECT
 CONCAT('lime_survey_', q.sid) AS table_name,
 CONCAT(q.sid , 'X', q.gid, 'X',
   (CASE WHEN q.parent_qid = 0 THEN q.qid ELSE q.parent_qid END),
   (CASE WHEN q.parent_qid <> 0 THEN q.title ELSE '' END)
 ) AS column_name,
 (grp.group_order * 100000) + (pq.question_order * 1000) + (q.question_order * 10) AS ORD,
 'Y' AS column_exists,
 q.question AS DESCR,
 'MCQA' AS HQTYPE,
 '0' AS 1STTIMEONLY,
 # '' AS EXTRA,
 # EXTRA contains the reference to the multiple-choice question
 CONCAT(q.sid , 'X', q.gid, 'X',
   (CASE WHEN q.parent_qid = 0 THEN q.qid ELSE q.parent_qid END)
 ) AS EXTRA,
 'Reference to question' AS MEANING_EXTRA,
 (SELECT COUNT(*) FROM `lime_question_attributes` sqa 
  WHERE sqa.qid = q.qid AND sqa.attribute = 'hidden' AND sqa.value = '1') AS HIDDEN,
 grp.group_name,
 q.*
FROM `lime_questions` q
  INNER JOIN `lime_groups` grp
  ON q.sid = grp.sid AND q.gid = grp.gid
  INNER JOIN `lime_questions` pq
  ON q.parent_qid = pq.qid
WHERE q.sid = 223796 AND q.type IN ('M','P','T')
## Tot 20190520 - WAS alleen type 'T' voor controle data-integriteit !!
## M = Multiple Choice antwoord
## P = Multiple Choice antwoord met commentaar
 
UNION
# Multiple choice comments
SELECT
 CONCAT('lime_survey_', q.sid) AS table_name,
 CONCAT(q.sid , 'X', q.gid, 'X', q.qid, sq.title, 'comment') AS column_name,
 (grp.group_order * 100000) + (q.question_order * 1000) + (sq.question_order * 10) + 1 AS ORD,
 'Y' AS column_exists,
 q.question AS DESCR,
 'CMNT' AS HQTYPE,
 '0' AS 1STTIMEONLY,
 # '' AS EXTRA,
 # EXTRA contains the reference to the multiple-choice question
 CONCAT(q.sid , 'X', q.gid, 'X',
   (CASE WHEN q.parent_qid = 0 THEN q.qid ELSE q.parent_qid END)
 ) AS EXTRA,
 'Reference to question' AS MEANING_EXTRA,
 (SELECT COUNT(*) FROM `lime_question_attributes` sqa 
  WHERE sqa.qid = q.qid AND sqa.attribute = 'hidden' AND sqa.value = '1') AS HIDDEN,
 grp.group_name,
 sq.*
FROM `lime_questions` q
  INNER JOIN `lime_groups` grp
  ON q.sid = grp.sid AND q.gid = grp.gid
  INNER JOIN `lime_questions` sq
  ON q.sid = sq.sid AND q.qid = sq.parent_qid
  AND q.type = 'P' AND sq.type in ('P','T')
## Tot 20190520 - WAS type 'T' voor controle data-integriteit !!
WHERE q.sid = 223796
 
UNION
# Multiple choice questions which have option 'Other'
SELECT
 CONCAT('lime_survey_', q.sid) AS table_name,
 CONCAT(q.sid , 'X', q.gid, 'X', (CASE WHEN q.parent_qid = 0 THEN q.qid ELSE q.parent_qid END), 'other') AS column_name,
 (grp.group_order * 100000) + (q.question_order * 1000) + 99 AS ORD,
 'Y' AS column_exists,
 'Anders' AS DESCR,
 'OTHR' AS HQTYPE,
 '0' AS 1STTIMEONLY,
 # '' AS EXTRA,
 # EXTRA contains the reference to the multiple-choice question
 CONCAT(q.sid , 'X', q.gid, 'X',
   (CASE WHEN q.parent_qid = 0 THEN q.qid ELSE q.parent_qid END)
 ) AS EXTRA,
 'Reference to question' AS MEANING_EXTRA,
 (SELECT COUNT(*) FROM `lime_question_attributes` sqa 
  WHERE sqa.qid = q.qid AND sqa.attribute = 'hidden' AND sqa.value = '1') AS HIDDEN,
 grp.group_name,
 q.*
FROM `lime_questions` q
  INNER JOIN `lime_groups` grp
  ON q.sid = grp.sid AND q.gid = grp.gid
WHERE q.sid = 223796 AND q.other = 'Y'
 
UNION
# File upload fields - filecount
SELECT
 CONCAT('lime_survey_', q.sid) AS table_name,
 CONCAT(q.sid , 'X', q.gid, 'X', (CASE WHEN q.parent_qid = 0 THEN q.qid ELSE q.parent_qid END), '_filecount') AS column_name,
 (grp.group_order * 100000) + (q.question_order * 1000) + 1 AS ORD,
 'Y' AS column_exists,
 q.question AS DESCR,
 'FCNT' AS HQTYPE,
 '0' AS 1STTIMEONLY,
 '' AS EXTRA,
 '' AS MEANING_EXTRA,
 (SELECT COUNT(*) FROM `lime_question_attributes` sqa 
  WHERE sqa.qid = q.qid AND sqa.attribute = 'hidden' AND sqa.value = '1') AS HIDDEN,
 grp.group_name,
 q.*
FROM `lime_questions` q
  INNER JOIN `lime_groups` grp
  ON q.sid = grp.sid AND q.gid = grp.gid
WHERE q.sid = 223796 AND q.type = '|'
 
UNION
# Long text fields
SELECT
 CONCAT('lime_survey_', q.sid) AS table_name,
 CONCAT(q.sid , 'X', q.gid, 'X', (CASE WHEN q.parent_qid = 0 THEN q.qid ELSE q.parent_qid END)) AS column_name,
 (grp.group_order * 100000) + (q.question_order * 1000) + 1 AS ORD,
 'Y' AS column_exists,
 q.question AS DESCR,
 'LTXT' AS HQTYPE,
 (SELECT COUNT(*) FROM `lime_conditions` c 
  WHERE c.qid = q.qid 
  AND c.cfieldname = '{TOKEN:USESLEFT}'
  AND c.method = '=='
  AND c.value = '1') AS 1STTIMEONLY,
 '' AS EXTRA,
 '' AS MEANING_EXTRA,
 (SELECT COUNT(*) FROM `lime_question_attributes` sqa 
  WHERE sqa.qid = q.qid AND sqa.attribute = 'hidden' AND sqa.value = '1') AS HIDDEN,
 grp.group_name,
 q.*
FROM `lime_questions` q
  INNER JOIN `lime_groups` grp
  ON q.sid = grp.sid AND q.gid = grp.gid
WHERE q.sid = 223796 AND q.type = 'T' AND q.parent_qid = 0
 
UNION
# Ranking fields
SELECT
 CONCAT('lime_survey_', q.sid) AS table_name,
 CONCAT(q.sid , 'X', q.gid, 'X', (CASE WHEN q.parent_qid = 0 THEN q.qid ELSE q.parent_qid END), a.sortorder) AS column_name,
 (grp.group_order * 100000) + (q.question_order * 1000) + (a.sortorder * 10) AS ORD,
 'Y' AS column_exists,
 a.answer AS DESCR,
 'RKGA' AS HQTYPE,
 '0' AS 1STTIMEONLY,
 '' AS EXTRA,
 '' AS MEANING_EXTRA,
 (SELECT COUNT(*) FROM `lime_question_attributes` sqa 
  WHERE sqa.qid = q.qid AND sqa.attribute = 'hidden' AND sqa.value = '1') AS HIDDEN,
 grp.group_name,
 q.*
FROM `lime_questions` q
  INNER JOIN `lime_groups` grp
  ON q.sid = grp.sid AND q.gid = grp.gid
  INNER JOIN `lime_answers` a
  ON q.qid = a.qid
WHERE q.sid = 223796 AND q.type = 'R'
 
UNION
# Radio button
SELECT
 CONCAT('lime_survey_', q.sid) AS table_name,
 CONCAT(q.sid , 'X', q.gid, 'X', q.qid) AS column_name,
 (grp.group_order * 100000) + (q.question_order * 1000) AS ORD,
 'Y' AS column_exists,
 q.question AS DESCR,
 'RDOQ' AS HQTYPE,
 (SELECT COUNT(*) FROM `lime_conditions` c 
  WHERE c.qid = q.qid 
  AND c.cfieldname = '{TOKEN:USESLEFT}'
  AND c.method = '=='
  AND c.value = '1') AS 1STTIMEONLY,
 '' AS EXTRA,
 '' AS MEANING_EXTRA,
 (SELECT COUNT(*) FROM `lime_question_attributes` sqa 
  WHERE sqa.qid = q.qid AND sqa.attribute = 'hidden' AND sqa.value = '1') AS HIDDEN,
 grp.group_name,
 q.*
FROM `lime_questions` q
  INNER JOIN `lime_groups` grp
  ON q.sid = grp.sid AND q.gid = grp.gid
WHERE q.sid = 223796 AND q.type in ('O','L')
 
UNION
# Radio button - all answers
SELECT
 CONCAT('lime_survey_', q.sid) AS table_name,
 #CONCAT(q.sid , 'X', q.gid, 'X', q.qid) AS column_name,
 # Deze kolomnaam bestaat niet, want alleen die voor de RDOQ hierboven bestaat
 # Dus voor de fake kolomnaam a.code toegevoegd
 CONCAT(q.sid , 'X', q.gid, 'X', q.qid, a.code) AS column_name,
 (grp.group_order * 100000) + (q.question_order * 1000) + (a.sortorder * 10) + 5 AS ORD,
 'N' AS column_exists,
 # CONCAT(a.code, '|', a.answer) AS DESCR,
 CONCAT(a.answer) AS DESCR,
 'RDOA' AS HQTYPE,
 '0' AS 1STTIMEONLY,
 # CONCAT(q.sid , 'X', q.gid, 'X', q.qid, '|', a.code) AS EXTRA,
 # 'Reference to question|Answer code or label' AS MEANING_EXTRA,
 CONCAT(q.sid , 'X', q.gid, 'X', q.qid) AS EXTRA,
 'Reference to question' AS MEANING_EXTRA,
 (SELECT COUNT(*) FROM `lime_question_attributes` sqa 
  WHERE sqa.qid = q.qid AND sqa.attribute = 'hidden' AND sqa.value = '1') AS HIDDEN,
 grp.group_name,
 q.*
FROM `lime_questions` q
  INNER JOIN `lime_groups` grp
  ON q.sid = grp.sid AND q.gid = grp.gid
  INNER JOIN `lime_answers` a
  ON q.qid = a.qid
WHERE q.sid = 223796 AND q.type in ('O','L')
 
 
UNION
# Radio button with comments
SELECT
 CONCAT('lime_survey_', q.sid) AS table_name,
 CONCAT(q.sid , 'X', q.gid, 'X', q.qid, 'comment') AS column_name,
 (grp.group_order * 100000) + (q.question_order * 1000) + 1 AS ORD,
 'Y' AS column_exists,
 q.question AS DESCR,
 'CMNT' AS HQTYPE,
 '0' AS 1STTIMEONLY,
 '' AS EXTRA,
 '' AS MEANING_EXTRA,
 (SELECT COUNT(*) FROM `lime_question_attributes` sqa 
  WHERE sqa.qid = q.qid AND sqa.attribute = 'hidden' AND sqa.value = '1') AS HIDDEN,
 grp.group_name,
 q.*
FROM `lime_questions` q
  INNER JOIN `lime_groups` grp
  ON q.sid = grp.sid AND q.gid = grp.gid
WHERE q.sid = 223796 AND q.type = 'O'
 
UNION
# Drop down list
SELECT
 CONCAT('lime_survey_', q.sid) AS table_name,
 CONCAT(q.sid , 'X', q.gid, 'X', q.qid) AS column_name,
 (grp.group_order * 100000) + (q.question_order * 1000) AS ORD,
 'Y' AS column_exists,
 q.question AS DESCR,
 'DDLQ' AS HQTYPE,
 (SELECT COUNT(*) FROM `lime_conditions` c 
  WHERE c.qid = q.qid 
  AND c.cfieldname = '{TOKEN:USESLEFT}'
  AND c.method = '=='
  AND c.value = '1') AS 1STTIMEONLY,
 '' AS EXTRA,
 '' AS MEANING_EXTRA,
 (SELECT COUNT(*) FROM `lime_question_attributes` sqa 
  WHERE sqa.qid = q.qid AND sqa.attribute = 'hidden' AND sqa.value = '1') AS HIDDEN,
 grp.group_name,
 q.*
FROM `lime_questions` q
  INNER JOIN `lime_groups` grp
  ON q.sid = grp.sid AND q.gid = grp.gid
WHERE q.sid = 223796 AND q.type in ('!')
 
UNION
# Drop down list - all answers
SELECT
 CONCAT('lime_survey_', q.sid) AS table_name,
 #CONCAT(q.sid , 'X', q.gid, 'X', q.qid) AS column_name,
 # Deze kolomnaam bestaat niet, want alleen die voor de RDOQ hierboven bestaat
 # Dus voor de fake kolomnaam a.code toegevoegd
 CONCAT(q.sid , 'X', q.gid, 'X', q.qid, a.code) AS column_name,
 (grp.group_order * 100000) + (q.question_order * 1000) + (a.sortorder * 10) + 5 AS ORD,
 'N' AS column_exists,
 # CONCAT(a.code, '|', a.answer) AS DESCR,
 CONCAT(a.answer) AS DESCR,
 'DDLA' AS HQTYPE,
 '0' AS 1STTIMEONLY,
 # CONCAT(q.sid , 'X', q.gid, 'X', q.qid, '|', a.code) AS EXTRA,
 # 'Reference to question|Answer code or label' AS MEANING_EXTRA,
 CONCAT(q.sid , 'X', q.gid, 'X', q.qid) AS EXTRA,
 'Reference to question' AS MEANING_EXTRA,
 (SELECT COUNT(*) FROM `lime_question_attributes` sqa 
  WHERE sqa.qid = q.qid AND sqa.attribute = 'hidden' AND sqa.value = '1') AS HIDDEN,
 grp.group_name,
 q.*
FROM `lime_questions` q
  INNER JOIN `lime_groups` grp
  ON q.sid = grp.sid AND q.gid = grp.gid
  INNER JOIN `lime_answers` a
  ON q.qid = a.qid
WHERE q.sid = 223796 AND q.type in ('!')
 
UNION
# Short text
SELECT
 CONCAT('lime_survey_', q.sid) AS table_name,
 CONCAT(q.sid , 'X', q.gid, 'X',
   (CASE WHEN q.parent_qid = 0 THEN q.qid ELSE q.parent_qid END),
   (CASE WHEN q.parent_qid <> 0 THEN q.title ELSE '' END)
 ) AS column_name,
 (grp.group_order * 100000) + (q.question_order * 1000) AS ORD,
 'Y' AS column_exists,
 q.question AS DESCR,
 'STXT' AS HQTYPE,
 (SELECT COUNT(*) FROM `lime_conditions` c 
  WHERE c.qid = q.qid 
  AND c.cfieldname = '{TOKEN:USESLEFT}'
  AND c.method = '=='
  AND c.value = '1') AS 1STTIMEONLY,
 '' AS EXTRA,
 '' AS MEANING_EXTRA,
 (SELECT COUNT(*) FROM `lime_question_attributes` sqa 
  WHERE sqa.qid = q.qid AND sqa.attribute = 'hidden' AND sqa.value = '1') AS HIDDEN,
 grp.group_name,
 q.*
FROM `lime_questions` q
  INNER JOIN `lime_groups` grp
  ON q.sid = grp.sid AND q.gid = grp.gid
  AND NOT EXISTS 
   (SELECT 1 FROM `lime_question_attributes` qattr
    WHERE q.qid = qattr.qid AND qattr.attribute = 'location_defaultcoordinates')	
WHERE q.sid = 223796 AND q.type IN ('S')
 
UNION
# Location with default coordinates !! (Hence inner join)
SELECT
 CONCAT('lime_survey_', q.sid) AS table_name,
 CONCAT(q.sid , 'X', q.gid, 'X',
   (CASE WHEN q.parent_qid = 0 THEN q.qid ELSE q.parent_qid END),
   (CASE WHEN q.parent_qid <> 0 THEN q.title ELSE '' END)
 ) AS column_name,
 (grp.group_order * 100000) + (q.question_order * 1000) AS ORD,
 'Y' AS column_exists,
 q.question AS DESCR,
 'LOCA' AS HQTYPE,
 (SELECT COUNT(*) FROM `lime_conditions` c 
  WHERE c.qid = q.qid 
  AND c.cfieldname = '{TOKEN:USESLEFT}'
  AND c.method = '=='
  AND c.value = '1') AS 1STTIMEONLY,
 # qattr.value AS EXTRA,
 CONCAT(locamc.value, ' ', locamz.value) AS EXTRA,
 'Coordinates latitude and longitude plus zoom level (space separated)' AS MEANING_EXTRA,
 (SELECT COUNT(*) FROM `lime_question_attributes` sqa 
  WHERE sqa.qid = q.qid AND sqa.attribute = 'hidden' AND sqa.value = '1') AS HIDDEN,
 grp.group_name,
 q.*
FROM `lime_questions` q
  INNER JOIN `lime_groups` grp
  ON q.sid = grp.sid AND q.gid = grp.gid
  # INNER JOIN `lime_question_attributes` qattr
  # ON q.qid = qattr.qid AND qattr.attribute = 'location_defaultcoordinates'	
  INNER JOIN `lime_question_attributes` locamc
  ON q.qid = locamc.qid AND locamc.attribute = 'location_defaultcoordinates' AND locamc.value != ''
  INNER JOIN `lime_question_attributes` locamz
  ON q.qid = locamz.qid AND locamz.attribute = 'location_mapzoom'
WHERE q.sid = 223796 AND q.type IN ('S')
 
UNION
# File upload field
SELECT
 CONCAT('lime_survey_', q.sid) AS table_name,
 CONCAT(q.sid , 'X', q.gid, 'X',
   (CASE WHEN q.parent_qid = 0 THEN q.qid ELSE q.parent_qid END),
   (CASE WHEN q.parent_qid <> 0 THEN q.title ELSE '' END)
 ) AS column_name,
 (grp.group_order * 100000) + (q.question_order * 1000) AS ORD,
 'Y' AS column_exists,
 q.question AS DESCR,
 'UPLD' AS HQTYPE,
 (SELECT COUNT(*) FROM `lime_conditions` c 
  WHERE c.qid = q.qid 
  AND c.cfieldname = '{TOKEN:USESLEFT}'
  AND c.method = '=='
  AND c.value = '1') AS 1STTIMEONLY,
 (SELECT value FROM `lime_question_attributes` qa
  WHERE qa.qid = q.qid 
  AND qa.attribute = 'allowed_filetypes') AS EXTRA,
 'allowed_filetypes' AS MEANING_EXTRA,
 (SELECT COUNT(*) FROM `lime_question_attributes` sqa 
  WHERE sqa.qid = q.qid AND sqa.attribute = 'hidden' AND sqa.value = '1') AS HIDDEN,
 grp.group_name,
 q.*
FROM `lime_questions` q
  INNER JOIN `lime_groups` grp
  ON q.sid = grp.sid AND q.gid = grp.gid
WHERE q.sid = 223796 AND q.type IN ('|')
 
UNION
# YES/NO field
SELECT
 CONCAT('lime_survey_', q.sid) AS table_name,
 CONCAT(q.sid , 'X', q.gid, 'X',
   (CASE WHEN q.parent_qid = 0 THEN q.qid ELSE q.parent_qid END),
   (CASE WHEN q.parent_qid <> 0 THEN q.title ELSE '' END)
 ) AS column_name,
 (grp.group_order * 100000) + (q.question_order * 1000) AS ORD,
 'Y' AS column_exists,
 q.question AS DESCR,
 'YSNO' AS HQTYPE,
 (SELECT COUNT(*) FROM `lime_conditions` c 
  WHERE c.qid = q.qid 
  AND c.cfieldname = '{TOKEN:USESLEFT}'
  AND c.method = '=='
  AND c.value = '1') AS 1STTIMEONLY,
 '' AS EXTRA,
 '' AS MEANING_EXTRA,
 (SELECT COUNT(*) FROM `lime_question_attributes` sqa 
  WHERE sqa.qid = q.qid AND sqa.attribute = 'hidden' AND sqa.value = '1') AS HIDDEN,
 grp.group_name,
 q.*
FROM `lime_questions` q
  INNER JOIN `lime_groups` grp
  ON q.sid = grp.sid AND q.gid = grp.gid
WHERE q.sid = 223796 AND q.type IN ('Y')
 
UNION
# Gender field  - 20191219 // Quick fix !!??
SELECT
 CONCAT('lime_survey_', q.sid) AS table_name,
 CONCAT(q.sid , 'X', q.gid, 'X',
   (CASE WHEN q.parent_qid = 0 THEN q.qid ELSE q.parent_qid END),
   (CASE WHEN q.parent_qid <> 0 THEN q.title ELSE '' END)
 ) AS column_name,
 (grp.group_order * 100000) + (q.question_order * 1000) AS ORD,
 'Y' AS column_exists,
 q.question AS DESCR,
 'GNDR' AS HQTYPE,
 (SELECT COUNT(*) FROM `lime_conditions` c 
  WHERE c.qid = q.qid 
  AND c.cfieldname = '{TOKEN:USESLEFT}'
  AND c.method = '=='
  AND c.value = '1') AS 1STTIMEONLY,
 '' AS EXTRA,
 '' AS MEANING_EXTRA,
 (SELECT COUNT(*) FROM `lime_question_attributes` sqa 
  WHERE sqa.qid = q.qid AND sqa.attribute = 'hidden' AND sqa.value = '1') AS HIDDEN,
 grp.group_name,
 q.*
FROM `lime_questions` q
  INNER JOIN `lime_groups` grp
  ON q.sid = grp.sid AND q.gid = grp.gid
WHERE q.sid = 223796 AND q.type IN ('G')
 
UNION
# Text field (static) - 20191219 - Value always NULL (?)
SELECT
 CONCAT('lime_survey_', q.sid) AS table_name,
 CONCAT(q.sid , 'X', q.gid, 'X',
   (CASE WHEN q.parent_qid = 0 THEN q.qid ELSE q.parent_qid END),
   (CASE WHEN q.parent_qid <> 0 THEN q.title ELSE '' END)
 ) AS column_name,
 (grp.group_order * 100000) + (q.question_order * 1000) AS ORD,
 'Y' AS column_exists,
 q.question AS DESCR,
 'TSCRN' AS HQTYPE,
 (SELECT COUNT(*) FROM `lime_conditions` c 
  WHERE c.qid = q.qid 
  AND c.cfieldname = '{TOKEN:USESLEFT}'
  AND c.method = '=='
  AND c.value = '1') AS 1STTIMEONLY,
 '' AS EXTRA,
 '' AS MEANING_EXTRA,
 (SELECT COUNT(*) FROM `lime_question_attributes` sqa 
  WHERE sqa.qid = q.qid AND sqa.attribute = 'hidden' AND sqa.value = '1') AS HIDDEN,
 grp.group_name,
 q.*
FROM `lime_questions` q
  INNER JOIN `lime_groups` grp
  ON q.sid = grp.sid AND q.gid = grp.gid
WHERE q.sid = 223796 AND q.type IN ('X')
 
 
UNION
# Het is een gesloten Multiple choice vraag 
# of één met optie Other
# of één met commentaarmogelijkheid
# of één die we nog niet kennen => GEENIDEE
# Do NOT exist as columns
SELECT
 CONCAT('lime_survey_', q.sid) AS table_name,
 CONCAT(q.sid , 'X', q.gid, 'X',
   (CASE WHEN q.parent_qid = 0 THEN q.qid ELSE q.parent_qid END),
   (CASE WHEN q.parent_qid <> 0 THEN q.title ELSE '' END)
 ) AS column_name,
 (grp.group_order * 100000) + (q.question_order * 1000) AS ORD,
 'N' AS column_exists,
 q.question AS DESCR,
 (CASE q.type
   WHEN 'M' THEN 'MCQ1'
   WHEN 'P' THEN 'MCQ2'
   WHEN 'R' THEN 'RKGQ'
 END) AS HQTYPE,
  (SELECT COUNT(*) FROM `lime_conditions` c 
  WHERE c.qid = q.qid 
  AND c.cfieldname = '{TOKEN:USESLEFT}'
  AND c.method = '=='
  AND c.value = '1') AS 1STTIMEONLY,
 '' AS EXTRA,
 '' AS MEANING_EXTRA,
 (SELECT COUNT(*) FROM `lime_question_attributes` sqa 
  WHERE sqa.qid = q.qid AND sqa.attribute = 'hidden' AND sqa.value = '1') AS HIDDEN,
 grp.group_name,
 q.*
FROM `lime_questions` q
  INNER JOIN `lime_groups` grp
  ON q.sid = grp.sid AND q.gid = grp.gid
WHERE q.sid = 223796 AND q.type IN ('M','R','P')
  AND q.parent_qid = 0
## Tot 20190520 - zonder laatste restrictie
 
ORDER BY 1, 3
SELECT
  # CONCAT('223796_', lime_survey_223796.id) AS SURVEY_REC_ID,
  CONCAT('223796_', LPAD(lime_survey_223796.id, 4, '0')) AS SURVEY_REC_ID,
  lime_tokens_223796.token,
  lime_survey_223796.seed,
  lime_survey_223796.submitdate,
  IF(CONCAT(lime_tokens_223796.firstname,lime_tokens_223796.lastname) = '', 'Anonieme', lime_tokens_223796.firstname) as firstname,
  IF(CONCAT(lime_tokens_223796.firstname,lime_tokens_223796.lastname) = '', 'Gebruiker', lime_tokens_223796.lastname) as lastname,
  lime_tokens_223796.email, 
  lime_tokens_223796.sent,
  lime_tokens_223796.completed,
  lime_survey_223796.223796X113X1657,
  lime_survey_223796.223796X113X1657_filecount,
  lime_survey_223796.223796X113X1658,
  lime_survey_223796.223796X113X1692,
  CASE lime_survey_223796.223796X113X1659
    WHEN 'M' THEN 'Man'
    WHEN 'F' THEN 'Vrouw'
    ELSE 'Onbekend'
  END AS 223796X113X1659,
  lime_survey_223796.223796X113X1660,
  lime_survey_223796.223796X113X1661SQ001,
  lime_survey_223796.223796X113X1661SQ002,
  lime_survey_223796.223796X113X1661SQ003,
  lime_survey_223796.223796X113X1661SQ004,
  lime_survey_223796.223796X113X1661SQ005,
  lime_survey_223796.223796X113X1661other,
  lime_survey_223796.223796X114X1667,
  lime_survey_223796.223796X114X1668,
  lime_survey_223796.223796X114X1696,
  lime_survey_223796.223796X114X1669,
  lime_survey_223796.223796X114X1690,
  lime_survey_223796.223796X114X1697,
  lime_survey_223796.223796X115X1670SQ001,
  lime_survey_223796.223796X115X1670SQ002,
  lime_survey_223796.223796X115X1670SQ003,
  lime_survey_223796.223796X115X1670SQ004,
  lime_survey_223796.223796X115X1670SQ005,
  lime_survey_223796.223796X115X1670SQ006,
  lime_survey_223796.223796X115X1670SQ007,
  lime_survey_223796.223796X115X1670SQ008,
  lime_survey_223796.223796X115X1670SQ009,
  lime_survey_223796.223796X115X1670SQ010,
  lime_survey_223796.223796X115X1670SQ011,
  lime_survey_223796.223796X115X1670SQ012,
  lime_survey_223796.223796X115X1682,
  lime_survey_223796.223796X115X1683,
  lime_survey_223796.223796X115X1691,
  lime_survey_223796.223796X115X1694,
  lime_survey_223796.223796X115X1695,
  lime_survey_223796.223796X115X1684,
  lime_survey_223796.223796X115X1693,
  lime_survey_223796.223796X115X1685,
  lime_survey_223796.223796X115X1685_filecount,
  lime_survey_223796.223796X115X1687,
  lime_survey_223796.223796X116X1689
FROM lime_survey_223796
INNER JOIN lime_tokens_223796
ON lime_survey_223796.token = lime_tokens_223796.token
WHERE lime_survey_223796.submitdate IS NOT NULL
ORDER BY lime_tokens_223796.token, lime_survey_223796.id

Column-To-Question-map

array (
  '223796X113X1657' => 
  array (
    'description' => '<strong>Upload een foto van jezelf.</strong>',
    'stripped_description' => 'Upload een foto van jezelf.',
    'core_description' => 'Upload een foto van jezelf.',
    'type' => '|',
    'group_name' => 'Wie ben je?',
    'hqtype' => 'UPLD',
    '1sttimeonly' => '0',
    'extra' => 'png, gif, jpg, jpeg',
    'meaning_extra' => 'allowed_filetypes',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'upload',
    'mandatory' => 'N',
    'question_nr' => 1,
    'main_question' => 1,
  ),
  '223796X113X1657_filecount' => 
  array (
    'description' => '<strong>Upload een foto van jezelf.</strong>',
    'stripped_description' => 'Upload een foto van jezelf.',
    'core_description' => 'Upload een foto van jezelf.',
    'type' => '|',
    'group_name' => 'Wie ben je?',
    'hqtype' => 'FCNT',
    '1sttimeonly' => '0',
    'extra' => '',
    'meaning_extra' => '',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'antwoord',
    'mandatory' => '-',
    'question_nr' => '',
    'main_question' => 0,
  ),
  '223796X113X1658' => 
  array (
    'description' => '<p><strong>Geef op de kaart aan waar je ongeveer woont.</strong> Als je niet in de Indische Buurt woont, mag het ook je werkplaats, school, kantoor of bedrijf zijn. </p>
',
    'stripped_description' => 'Geef op de kaart aan waar je ongeveer woont. Als je niet in de Indische Buurt woont, mag het ook je werkplaats, school, kantoor of bedrijf zijn. ',
    'core_description' => 'Geef op de kaart aan waar je ongeveer woont.',
    'type' => 'S',
    'group_name' => 'Wie ben je?',
    'hqtype' => 'LOCA',
    '1sttimeonly' => '0',
    'extra' => '52.361814 4.939646 15',
    'meaning_extra' => 'Coordinates latitude and longitude plus zoom level (space separated)',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'locatie',
    'mandatory' => 'N',
    'question_nr' => 2,
    'main_question' => 1,
  ),
  '223796X113X1692' => 
  array (
    'description' => '<strong>Hoe heet de locatie waar je woont, werkt of studeert?</strong> Dit hoeft niet de officiële naam te zijn.',
    'stripped_description' => 'Hoe heet de locatie waar je woont, werkt of studeert? Dit hoeft niet de officiële naam te zijn.',
    'core_description' => 'Hoe heet de locatie waar je woont, werkt of studeert?',
    'type' => 'T',
    'group_name' => 'Wie ben je?',
    'hqtype' => 'LTXT',
    '1sttimeonly' => '0',
    'extra' => '',
    'meaning_extra' => '',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'open',
    'mandatory' => 'N',
    'question_nr' => 3,
    'main_question' => 1,
  ),
  '223796X113X1659' => 
  array (
    'description' => '<strong>Wat is je geslacht?</strong>',
    'stripped_description' => 'Wat is je geslacht?',
    'core_description' => 'Wat is je geslacht?',
    'type' => 'G',
    'group_name' => 'Wie ben je?',
    'hqtype' => 'GNDR',
    '1sttimeonly' => '0',
    'extra' => '',
    'meaning_extra' => '',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'keuze',
    'mandatory' => 'N',
    'question_nr' => 4,
    'main_question' => 1,
  ),
  '223796X113X1660' => 
  array (
    'description' => '<strong>Wat is je leeftijd?</strong>',
    'stripped_description' => 'Wat is je leeftijd?',
    'core_description' => 'Wat is je leeftijd?',
    'type' => 'L',
    'group_name' => 'Wie ben je?',
    'hqtype' => 'RDOQ',
    '1sttimeonly' => '0',
    'extra' => '',
    'meaning_extra' => '',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'keuze',
    'mandatory' => 'N',
    'question_nr' => 5,
    'main_question' => 1,
  ),
  '223796X113X1660A2' => 
  array (
    'description' => '<strong>18 tot 30 jaar</strong>',
    'stripped_description' => '18 tot 30 jaar',
    'core_description' => '18 tot 30 jaar',
    'type' => 'L',
    'group_name' => 'Wie ben je?',
    'hqtype' => 'RDOA',
    '1sttimeonly' => '0',
    'extra' => '223796X113X1660',
    'meaning_extra' => 'Reference to question',
    'hidden' => 0,
    'column_exists' => 'N',
    'hqtype_descr' => 'antwoord',
    'mandatory' => '-',
    'question_nr' => '',
    'main_question' => 0,
  ),
  '223796X113X1660A3' => 
  array (
    'description' => '<strong>30 tot 55 jaar</strong>',
    'stripped_description' => '30 tot 55 jaar',
    'core_description' => '30 tot 55 jaar',
    'type' => 'L',
    'group_name' => 'Wie ben je?',
    'hqtype' => 'RDOA',
    '1sttimeonly' => '0',
    'extra' => '223796X113X1660',
    'meaning_extra' => 'Reference to question',
    'hidden' => 0,
    'column_exists' => 'N',
    'hqtype_descr' => 'antwoord',
    'mandatory' => '-',
    'question_nr' => '',
    'main_question' => 0,
  ),
  '223796X113X1660A4' => 
  array (
    'description' => '<strong>55 tot 70 jaar</strong>',
    'stripped_description' => '55 tot 70 jaar',
    'core_description' => '55 tot 70 jaar',
    'type' => 'L',
    'group_name' => 'Wie ben je?',
    'hqtype' => 'RDOA',
    '1sttimeonly' => '0',
    'extra' => '223796X113X1660',
    'meaning_extra' => 'Reference to question',
    'hidden' => 0,
    'column_exists' => 'N',
    'hqtype_descr' => 'antwoord',
    'mandatory' => '-',
    'question_nr' => '',
    'main_question' => 0,
  ),
  '223796X113X1660A5' => 
  array (
    'description' => '<strong>70 jaar en ouder</strong>',
    'stripped_description' => '70 jaar en ouder',
    'core_description' => '70 jaar en ouder',
    'type' => 'L',
    'group_name' => 'Wie ben je?',
    'hqtype' => 'RDOA',
    '1sttimeonly' => '0',
    'extra' => '223796X113X1660',
    'meaning_extra' => 'Reference to question',
    'hidden' => 0,
    'column_exists' => 'N',
    'hqtype_descr' => 'antwoord',
    'mandatory' => '-',
    'question_nr' => '',
    'main_question' => 0,
  ),
  '223796X113X1661' => 
  array (
    'description' => 'Geef aan hoe je betrokken bent bij de Indische Buurt. Meerdere antwoorden zijn mogelijk. Als het antwoord er niet bij staat, kies Anders en vul aan. <strong>Ik ben betrokken bij de Indische Buurt als ... :</strong>',
    'stripped_description' => 'Geef aan hoe je betrokken bent bij de Indische Buurt. Meerdere antwoorden zijn mogelijk. Als het antwoord er niet bij staat, kies Anders en vul aan. Ik ben betrokken bij de Indische Buurt als ... :',
    'core_description' => 'Ik ben betrokken bij de Indische Buurt als ... :',
    'type' => 'M',
    'group_name' => 'Wie ben je?',
    'hqtype' => 'MCQ1',
    '1sttimeonly' => '0',
    'extra' => '',
    'meaning_extra' => '',
    'hidden' => 0,
    'column_exists' => 'N',
    'hqtype_descr' => 'meerkeuze',
    'mandatory' => 'N',
    'question_nr' => 6,
    'main_question' => 1,
  ),
  '223796X113X1661SQ001' => 
  array (
    'description' => '<strong>Bewoner</strong>: ik woon in de IB.',
    'stripped_description' => 'Bewoner: ik woon in de IB.',
    'core_description' => 'Bewoner',
    'type' => 'T',
    'group_name' => 'Wie ben je?',
    'hqtype' => 'MCQA',
    '1sttimeonly' => '0',
    'extra' => '223796X113X1661',
    'meaning_extra' => 'Reference to question',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'antwoord',
    'mandatory' => '-',
    'question_nr' => '',
    'main_question' => 0,
  ),
  '223796X113X1661SQ002' => 
  array (
    'description' => '<strong>Student</strong>: ik studeer in de IB',
    'stripped_description' => 'Student: ik studeer in de IB',
    'core_description' => 'Student',
    'type' => 'T',
    'group_name' => 'Wie ben je?',
    'hqtype' => 'MCQA',
    '1sttimeonly' => '0',
    'extra' => '223796X113X1661',
    'meaning_extra' => 'Reference to question',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'antwoord',
    'mandatory' => '-',
    'question_nr' => '',
    'main_question' => 0,
  ),
  '223796X113X1661SQ003' => 
  array (
    'description' => '<strong>Werknemer</strong>: ik werk in de IB',
    'stripped_description' => 'Werknemer: ik werk in de IB',
    'core_description' => 'Werknemer',
    'type' => 'T',
    'group_name' => 'Wie ben je?',
    'hqtype' => 'MCQA',
    '1sttimeonly' => '0',
    'extra' => '223796X113X1661',
    'meaning_extra' => 'Reference to question',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'antwoord',
    'mandatory' => '-',
    'question_nr' => '',
    'main_question' => 0,
  ),
  '223796X113X1661SQ004' => 
  array (
    'description' => '<strong>Ondernemer, winkelier, zelfstandige</strong>: ik heb een bedrijf in de IB.',
    'stripped_description' => 'Ondernemer, winkelier, zelfstandige: ik heb een bedrijf in de IB.',
    'core_description' => 'Ondernemer, winkelier, zelfstandige',
    'type' => 'T',
    'group_name' => 'Wie ben je?',
    'hqtype' => 'MCQA',
    '1sttimeonly' => '0',
    'extra' => '223796X113X1661',
    'meaning_extra' => 'Reference to question',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'antwoord',
    'mandatory' => '-',
    'question_nr' => '',
    'main_question' => 0,
  ),
  '223796X113X1661SQ005' => 
  array (
    'description' => '<strong>Bezoeker</strong> van bijv. winkel, café, restaurant, club, wandelgebied: ik bezoek/recreëer in de IB',
    'stripped_description' => 'Bezoeker van bijv. winkel, café, restaurant, club, wandelgebied: ik bezoek/recreëer in de IB',
    'core_description' => 'Bezoeker',
    'type' => 'T',
    'group_name' => 'Wie ben je?',
    'hqtype' => 'MCQA',
    '1sttimeonly' => '0',
    'extra' => '223796X113X1661',
    'meaning_extra' => 'Reference to question',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'antwoord',
    'mandatory' => '-',
    'question_nr' => '',
    'main_question' => 0,
  ),
  '223796X113X1661other' => 
  array (
    'description' => 'Anders',
    'stripped_description' => 'Anders',
    'core_description' => 'Anders',
    'type' => 'M',
    'group_name' => 'Wie ben je?',
    'hqtype' => 'OTHR',
    '1sttimeonly' => '0',
    'extra' => '223796X113X1661',
    'meaning_extra' => 'Reference to question',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'antwoord',
    'mandatory' => '-',
    'question_nr' => '',
    'main_question' => 0,
  ),
  '223796X114X1667' => 
  array (
    'description' => '<strong>Wat vind jij persoonlijk de belangrijkste plek van de Indische Buurt?</strong> Wijs de locatie aan op de kaart. Dit kan een station, school, park, straat, winkel, etc. zijn. Maar ook de straat waar je woont of waar je werkt mag je aanwijzen. ',
    'stripped_description' => 'Wat vind jij persoonlijk de belangrijkste plek van de Indische Buurt? Wijs de locatie aan op de kaart. Dit kan een station, school, park, straat, winkel, etc. zijn. Maar ook de straat waar je woont of waar je werkt mag je aanwijzen. ',
    'core_description' => 'Wat vind jij persoonlijk de belangrijkste plek van de Indische Buurt?',
    'type' => 'S',
    'group_name' => 'Prioriteiten',
    'hqtype' => 'LOCA',
    '1sttimeonly' => '0',
    'extra' => '52.361814 4.939646 15',
    'meaning_extra' => 'Coordinates latitude and longitude plus zoom level (space separated)',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'locatie',
    'mandatory' => 'N',
    'question_nr' => 7,
    'main_question' => 1,
  ),
  '223796X114X1668' => 
  array (
    'description' => '<strong>Wat is de naam van deze plek?</strong>',
    'stripped_description' => 'Wat is de naam van deze plek?',
    'core_description' => 'Wat is de naam van deze plek?',
    'type' => 'T',
    'group_name' => 'Prioriteiten',
    'hqtype' => 'LTXT',
    '1sttimeonly' => '0',
    'extra' => '',
    'meaning_extra' => '',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'open',
    'mandatory' => 'N',
    'question_nr' => 8,
    'main_question' => 1,
  ),
  '223796X114X1696' => 
  array (
    'description' => 'Interpretatie Naam Plek 1',
    'stripped_description' => 'Interpretatie Naam Plek 1',
    'core_description' => 'Interpretatie Naam Plek 1',
    'type' => 'T',
    'group_name' => 'Prioriteiten',
    'hqtype' => 'LTXT',
    '1sttimeonly' => '0',
    'extra' => '',
    'meaning_extra' => '',
    'hidden' => 1,
    'column_exists' => 'Y',
    'hqtype_descr' => 'open',
    'mandatory' => 'N',
    'question_nr' => 9,
    'main_question' => 1,
  ),
  '223796X114X1669' => 
  array (
    'description' => '<strong>Als je nog een belangrijke locatie hebt, wijs deze aan.</strong><br />
(Voor het geval je later nog meer locaties wilt opgeven dan is dat altijd mogelijk.)',
    'stripped_description' => 'Als je nog een belangrijke locatie hebt, wijs deze aan. (Voor het geval je later nog meer locaties wilt opgeven dan is dat altijd mogelijk.)',
    'core_description' => 'Als je nog een belangrijke locatie hebt, wijs deze aan.',
    'type' => 'S',
    'group_name' => 'Prioriteiten',
    'hqtype' => 'LOCA',
    '1sttimeonly' => '0',
    'extra' => '52.361814 4.939646 15',
    'meaning_extra' => 'Coordinates latitude and longitude plus zoom level (space separated)',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'locatie',
    'mandatory' => 'N',
    'question_nr' => 10,
    'main_question' => 1,
  ),
  '223796X114X1690' => 
  array (
    'description' => '<strong>Wat is de naam van deze plek?</strong>',
    'stripped_description' => 'Wat is de naam van deze plek?',
    'core_description' => 'Wat is de naam van deze plek?',
    'type' => 'T',
    'group_name' => 'Prioriteiten',
    'hqtype' => 'LTXT',
    '1sttimeonly' => '0',
    'extra' => '',
    'meaning_extra' => '',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'open',
    'mandatory' => 'N',
    'question_nr' => 11,
    'main_question' => 1,
  ),
  '223796X114X1697' => 
  array (
    'description' => 'Interpretatie Naam Plek 2',
    'stripped_description' => 'Interpretatie Naam Plek 2',
    'core_description' => 'Interpretatie Naam Plek 2',
    'type' => 'T',
    'group_name' => 'Prioriteiten',
    'hqtype' => 'LTXT',
    '1sttimeonly' => '0',
    'extra' => '',
    'meaning_extra' => '',
    'hidden' => 1,
    'column_exists' => 'Y',
    'hqtype_descr' => 'open',
    'mandatory' => 'N',
    'question_nr' => 12,
    'main_question' => 1,
  ),
  '223796X115X1670' => 
  array (
    'description' => '<strong>Over welke thema\'s zou je willen meepraten?</strong>',
    'stripped_description' => 'Over welke thema\'s zou je willen meepraten?',
    'core_description' => 'Over welke thema\'s zou je willen meepraten?',
    'type' => 'M',
    'group_name' => 'Thema\'s',
    'hqtype' => 'MCQ1',
    '1sttimeonly' => '0',
    'extra' => '',
    'meaning_extra' => '',
    'hidden' => 0,
    'column_exists' => 'N',
    'hqtype_descr' => 'meerkeuze',
    'mandatory' => 'N',
    'question_nr' => 13,
    'main_question' => 1,
  ),
  '223796X115X1670SQ001' => 
  array (
    'description' => '<strong>Armoede</strong>',
    'stripped_description' => 'Armoede',
    'core_description' => 'Armoede',
    'type' => 'T',
    'group_name' => 'Thema\'s',
    'hqtype' => 'MCQA',
    '1sttimeonly' => '0',
    'extra' => '223796X115X1670',
    'meaning_extra' => 'Reference to question',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'antwoord',
    'mandatory' => '-',
    'question_nr' => '',
    'main_question' => 0,
  ),
  '223796X115X1670SQ002' => 
  array (
    'description' => '<strong>Eenzaamheid</strong>',
    'stripped_description' => 'Eenzaamheid',
    'core_description' => 'Eenzaamheid',
    'type' => 'T',
    'group_name' => 'Thema\'s',
    'hqtype' => 'MCQA',
    '1sttimeonly' => '0',
    'extra' => '223796X115X1670',
    'meaning_extra' => 'Reference to question',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'antwoord',
    'mandatory' => '-',
    'question_nr' => '',
    'main_question' => 0,
  ),
  '223796X115X1670SQ003' => 
  array (
    'description' => '<strong>Lokale democratie</strong>',
    'stripped_description' => 'Lokale democratie',
    'core_description' => 'Lokale democratie',
    'type' => 'T',
    'group_name' => 'Thema\'s',
    'hqtype' => 'MCQA',
    '1sttimeonly' => '0',
    'extra' => '223796X115X1670',
    'meaning_extra' => 'Reference to question',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'antwoord',
    'mandatory' => '-',
    'question_nr' => '',
    'main_question' => 0,
  ),
  '223796X115X1670SQ004' => 
  array (
    'description' => '<strong>Jeugd en onderwijs</strong>',
    'stripped_description' => 'Jeugd en onderwijs',
    'core_description' => 'Jeugd en onderwijs',
    'type' => 'T',
    'group_name' => 'Thema\'s',
    'hqtype' => 'MCQA',
    '1sttimeonly' => '0',
    'extra' => '223796X115X1670',
    'meaning_extra' => 'Reference to question',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'antwoord',
    'mandatory' => '-',
    'question_nr' => '',
    'main_question' => 0,
  ),
  '223796X115X1670SQ005' => 
  array (
    'description' => '<strong>Gezondheid en zorg</strong>',
    'stripped_description' => 'Gezondheid en zorg',
    'core_description' => 'Gezondheid en zorg',
    'type' => 'T',
    'group_name' => 'Thema\'s',
    'hqtype' => 'MCQA',
    '1sttimeonly' => '0',
    'extra' => '223796X115X1670',
    'meaning_extra' => 'Reference to question',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'antwoord',
    'mandatory' => '-',
    'question_nr' => '',
    'main_question' => 0,
  ),
  '223796X115X1670SQ006' => 
  array (
    'description' => '<strong>Duurzaamheid</strong>',
    'stripped_description' => 'Duurzaamheid',
    'core_description' => 'Duurzaamheid',
    'type' => 'T',
    'group_name' => 'Thema\'s',
    'hqtype' => 'MCQA',
    '1sttimeonly' => '0',
    'extra' => '223796X115X1670',
    'meaning_extra' => 'Reference to question',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'antwoord',
    'mandatory' => '-',
    'question_nr' => '',
    'main_question' => 0,
  ),
  '223796X115X1670SQ007' => 
  array (
    'description' => '<strong>Veiligheid en openbare orde</strong>',
    'stripped_description' => 'Veiligheid en openbare orde',
    'core_description' => 'Veiligheid en openbare orde',
    'type' => 'T',
    'group_name' => 'Thema\'s',
    'hqtype' => 'MCQA',
    '1sttimeonly' => '0',
    'extra' => '223796X115X1670',
    'meaning_extra' => 'Reference to question',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'antwoord',
    'mandatory' => '-',
    'question_nr' => '',
    'main_question' => 0,
  ),
  '223796X115X1670SQ008' => 
  array (
    'description' => '<strong>Diversiteit</strong>',
    'stripped_description' => 'Diversiteit',
    'core_description' => 'Diversiteit',
    'type' => 'T',
    'group_name' => 'Thema\'s',
    'hqtype' => 'MCQA',
    '1sttimeonly' => '0',
    'extra' => '223796X115X1670',
    'meaning_extra' => 'Reference to question',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'antwoord',
    'mandatory' => '-',
    'question_nr' => '',
    'main_question' => 0,
  ),
  '223796X115X1670SQ009' => 
  array (
    'description' => '<strong>Werk en economie</strong>',
    'stripped_description' => 'Werk en economie',
    'core_description' => 'Werk en economie',
    'type' => 'T',
    'group_name' => 'Thema\'s',
    'hqtype' => 'MCQA',
    '1sttimeonly' => '0',
    'extra' => '223796X115X1670',
    'meaning_extra' => 'Reference to question',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'antwoord',
    'mandatory' => '-',
    'question_nr' => '',
    'main_question' => 0,
  ),
  '223796X115X1670SQ010' => 
  array (
    'description' => '<strong>Ontmoeting en sociale cohesie</strong>',
    'stripped_description' => 'Ontmoeting en sociale cohesie',
    'core_description' => 'Ontmoeting en sociale cohesie',
    'type' => 'T',
    'group_name' => 'Thema\'s',
    'hqtype' => 'MCQA',
    '1sttimeonly' => '0',
    'extra' => '223796X115X1670',
    'meaning_extra' => 'Reference to question',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'antwoord',
    'mandatory' => '-',
    'question_nr' => '',
    'main_question' => 0,
  ),
  '223796X115X1670SQ011' => 
  array (
    'description' => '<strong>Kunst en cultuur</strong>',
    'stripped_description' => 'Kunst en cultuur',
    'core_description' => 'Kunst en cultuur',
    'type' => 'T',
    'group_name' => 'Thema\'s',
    'hqtype' => 'MCQA',
    '1sttimeonly' => '0',
    'extra' => '223796X115X1670',
    'meaning_extra' => 'Reference to question',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'antwoord',
    'mandatory' => '-',
    'question_nr' => '',
    'main_question' => 0,
  ),
  '223796X115X1670SQ012' => 
  array (
    'description' => '<strong>Verkeer en wonen</strong>',
    'stripped_description' => 'Verkeer en wonen',
    'core_description' => 'Verkeer en wonen',
    'type' => 'T',
    'group_name' => 'Thema\'s',
    'hqtype' => 'MCQA',
    '1sttimeonly' => '0',
    'extra' => '223796X115X1670',
    'meaning_extra' => 'Reference to question',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'antwoord',
    'mandatory' => '-',
    'question_nr' => '',
    'main_question' => 0,
  ),
  '223796X115X1682' => 
  array (
    'description' => 'We zijn benieuwd welke ideeën bewoners en bezoekers hebben om een probleem/thema aan te pakken. <strong>Heb jij een idee over de aanpak van een probleem/thema?</strong>',
    'stripped_description' => 'We zijn benieuwd welke ideeën bewoners en bezoekers hebben om een probleem/thema aan te pakken. Heb jij een idee over de aanpak van een probleem/thema?',
    'core_description' => 'Heb jij een idee over de aanpak van een probleem/thema?',
    'type' => 'Y',
    'group_name' => 'Thema\'s',
    'hqtype' => 'YSNO',
    '1sttimeonly' => '0',
    'extra' => '',
    'meaning_extra' => '',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'keuze',
    'mandatory' => 'N',
    'question_nr' => 14,
    'main_question' => 1,
  ),
  '223796X115X1683' => 
  array (
    'description' => '<strong>Is jouw idee te koppelen aan een locatie op de kaart?</strong> Zo ja, wijs de locatie aan op de kaart. Als er geen locatie bij hoort, sla deze vraag dan over.',
    'stripped_description' => 'Is jouw idee te koppelen aan een locatie op de kaart? Zo ja, wijs de locatie aan op de kaart. Als er geen locatie bij hoort, sla deze vraag dan over.',
    'core_description' => 'Is jouw idee te koppelen aan een locatie op de kaart?',
    'type' => 'S',
    'group_name' => 'Thema\'s',
    'hqtype' => 'LOCA',
    '1sttimeonly' => '0',
    'extra' => '52.361814 4.939646 15',
    'meaning_extra' => 'Coordinates latitude and longitude plus zoom level (space separated)',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'locatie',
    'mandatory' => 'N',
    'question_nr' => 15,
    'main_question' => 1,
  ),
  '223796X115X1691' => 
  array (
    'description' => '<strong>Wat is de naam van de locatie waar je jouw idee kunt uitvoeren?</strong> Dit kan de naam van een school, park, straat, plein, winkel of wat dan ook zijn. Meer locaties invullen kan aan tafel. Vul voor nu de belangrijkste locatie in.',
    'stripped_description' => 'Wat is de naam van de locatie waar je jouw idee kunt uitvoeren? Dit kan de naam van een school, park, straat, plein, winkel of wat dan ook zijn. Meer locaties invullen kan aan tafel. Vul voor nu de belangrijkste locatie in.',
    'core_description' => 'Wat is de naam van de locatie waar je jouw idee kunt uitvoeren?',
    'type' => 'T',
    'group_name' => 'Thema\'s',
    'hqtype' => 'LTXT',
    '1sttimeonly' => '0',
    'extra' => '',
    'meaning_extra' => '',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'open',
    'mandatory' => 'N',
    'question_nr' => 16,
    'main_question' => 1,
  ),
  '223796X115X1694' => 
  array (
    'description' => 'Wat is je idee? <strong>Ik wil dat er ...</strong>',
    'stripped_description' => 'Wat is je idee? Ik wil dat er ...',
    'core_description' => 'Ik wil dat er ...',
    'type' => 'T',
    'group_name' => 'Thema\'s',
    'hqtype' => 'LTXT',
    '1sttimeonly' => '0',
    'extra' => '',
    'meaning_extra' => '',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'open',
    'mandatory' => 'N',
    'question_nr' => 17,
    'main_question' => 1,
  ),
  '223796X115X1695' => 
  array (
    'description' => 'Interpretatie idee: ik wil dat er ...',
    'stripped_description' => 'Interpretatie idee: ik wil dat er ...',
    'core_description' => 'Interpretatie idee: ik wil dat er ...',
    'type' => 'T',
    'group_name' => 'Thema\'s',
    'hqtype' => 'LTXT',
    '1sttimeonly' => '0',
    'extra' => '',
    'meaning_extra' => '',
    'hidden' => 1,
    'column_exists' => 'Y',
    'hqtype_descr' => 'open',
    'mandatory' => 'N',
    'question_nr' => 18,
    'main_question' => 1,
  ),
  '223796X115X1684' => 
  array (
    'description' => 'Vul de volgende zin aan.<strong> Als we jouw idee uitvoeren dan zorgt dat ervoor dat ...</strong>',
    'stripped_description' => 'Vul de volgende zin aan. Als we jouw idee uitvoeren dan zorgt dat ervoor dat ...',
    'core_description' => ' Als we jouw idee uitvoeren dan zorgt dat ervoor dat ...',
    'type' => 'T',
    'group_name' => 'Thema\'s',
    'hqtype' => 'LTXT',
    '1sttimeonly' => '0',
    'extra' => '',
    'meaning_extra' => '',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'open',
    'mandatory' => 'N',
    'question_nr' => 19,
    'main_question' => 1,
  ),
  '223796X115X1693' => 
  array (
    'description' => '<strong>Interpretatie</strong>: Als we jouw idee uitvoeren dan zorgt dat ervoor dat ..',
    'stripped_description' => 'Interpretatie: Als we jouw idee uitvoeren dan zorgt dat ervoor dat ..',
    'core_description' => 'Interpretatie',
    'type' => 'T',
    'group_name' => 'Thema\'s',
    'hqtype' => 'LTXT',
    '1sttimeonly' => '0',
    'extra' => '',
    'meaning_extra' => '',
    'hidden' => 1,
    'column_exists' => 'Y',
    'hqtype_descr' => 'open',
    'mandatory' => 'N',
    'question_nr' => 20,
    'main_question' => 1,
  ),
  '223796X115X1685' => 
  array (
    'description' => 'Mogelijk heb je dit idee al eerder ingebracht of heb je al langer over het idee nagedacht of gelezen. We willen zoveel mogelijk van je idee weten. <strong>Upload eventueel een foto, document of krantenartikel dat bij jouw idee hoort.</strong> ',
    'stripped_description' => 'Mogelijk heb je dit idee al eerder ingebracht of heb je al langer over het idee nagedacht of gelezen. We willen zoveel mogelijk van je idee weten. Upload eventueel een foto, document of krantenartikel dat bij jouw idee hoort. ',
    'core_description' => 'Upload eventueel een foto, document of krantenartikel dat bij jouw idee hoort.',
    'type' => '|',
    'group_name' => 'Thema\'s',
    'hqtype' => 'UPLD',
    '1sttimeonly' => '0',
    'extra' => 'png, gif, doc, odt, jpg, pdf, jpeg,docx',
    'meaning_extra' => 'allowed_filetypes',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'upload',
    'mandatory' => 'N',
    'question_nr' => 21,
    'main_question' => 1,
  ),
  '223796X115X1685_filecount' => 
  array (
    'description' => 'Mogelijk heb je dit idee al eerder ingebracht of heb je al langer over het idee nagedacht of gelezen. We willen zoveel mogelijk van je idee weten. <strong>Upload eventueel een foto, document of krantenartikel dat bij jouw idee hoort.</strong> ',
    'stripped_description' => 'Mogelijk heb je dit idee al eerder ingebracht of heb je al langer over het idee nagedacht of gelezen. We willen zoveel mogelijk van je idee weten. Upload eventueel een foto, document of krantenartikel dat bij jouw idee hoort. ',
    'core_description' => 'Upload eventueel een foto, document of krantenartikel dat bij jouw idee hoort.',
    'type' => '|',
    'group_name' => 'Thema\'s',
    'hqtype' => 'FCNT',
    '1sttimeonly' => '0',
    'extra' => '',
    'meaning_extra' => '',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'antwoord',
    'mandatory' => '-',
    'question_nr' => '',
    'main_question' => 0,
  ),
  '223796X115X1687' => 
  array (
    'description' => 'Mogelijk is er een link naar een artikel, facebookpost, linked-in artikl, boek of tijdschrift die bij je idee past. <strong>Vul deze link hier in.</strong>',
    'stripped_description' => 'Mogelijk is er een link naar een artikel, facebookpost, linked-in artikl, boek of tijdschrift die bij je idee past. Vul deze link hier in.',
    'core_description' => 'Vul deze link hier in.',
    'type' => 'T',
    'group_name' => 'Thema\'s',
    'hqtype' => 'LTXT',
    '1sttimeonly' => '0',
    'extra' => '',
    'meaning_extra' => '',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'open',
    'mandatory' => 'N',
    'question_nr' => 22,
    'main_question' => 1,
  ),
  '223796X116X1689' => 
  array (
    'description' => '<p>Bedankt voor je deelname. Mogelijk zijn we een vraag vergeten of wil je nog iets aan ons meegeven.</p>
 
<p><strong>Ik wil jullie het volgende laten weten:</strong></p>
',
    'stripped_description' => 'Bedankt voor je deelname. Mogelijk zijn we een vraag vergeten of wil je nog iets aan ons meegeven. Ik wil jullie het volgende laten weten:',
    'core_description' => 'Ik wil jullie het volgende laten weten:',
    'type' => 'T',
    'group_name' => 'Afsluiting',
    'hqtype' => 'LTXT',
    '1sttimeonly' => '0',
    'extra' => '',
    'meaning_extra' => '',
    'hidden' => 0,
    'column_exists' => 'Y',
    'hqtype_descr' => 'open',
    'mandatory' => 'N',
    'question_nr' => 23,
    'main_question' => 1,
  ),
)

Qnrs

array (
  0 => 
  array (
    'label' => 'OBJECT',
    'org' => '16',
    'int' => '99',
  ),
  1 => 
  array (
    'label' => 'IDEA',
    'org' => '17',
    'int' => '18',
  ),
  2 => 
  array (
    'label' => 'GOAL',
    'org' => '19',
    'int' => '20',
  ),
)

Qcols

array (
  0 => 
  array (
    'label' => 'OBJECT',
    'org' => '223796X115X1691',
    'int' => '99',
  ),
  1 => 
  array (
    'label' => 'IDEA',
    'org' => '223796X115X1694',
    'int' => '223796X115X1695',
  ),
  2 => 
  array (
    'label' => 'GOAL',
    'org' => '223796X115X1684',
    'int' => '223796X115X1693',
  ),
)