Created
February 4, 2025 14:16
-
-
Save oeon/616d5f502ac6a422dc94ab86807617a9 to your computer and use it in GitHub Desktop.
Fulcrum choice values from forms table element, data_name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH RECURSIVE nested_elements AS ( | |
SELECT jsonb_array_elements(elements::jsonb) AS element | |
FROM forms | |
WHERE name = 'Structure Brushing 2025' | |
UNION ALL | |
SELECT jsonb_array_elements(element->'elements') | |
FROM nested_elements | |
WHERE element ? 'elements' | |
) | |
SELECT | |
element->>'choices' AS choices | |
FROM | |
nested_elements | |
WHERE | |
element->>'data_name' = 'environmental_survey_type_visit_1'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment