Skip to main content

Query Data Dictionary

This is a work in progress. Only tested with CJ queries.

Given the GUID of a query, this will spit out a rather rough โ€œdata dictionaryโ€ showing all the possible prompt outputs for each field or the source of each field for fields like Address Country.

Useful for communicating across orgs/teams when building integrations.

SELECT qp.[id]
ย  ย  ,qp.[name] [Export Name]
ย  ย  ,lq.[field]
ย  ย  ,lq.[select]
ย  ย  ,lq.[field_prompt]
ย  ย  ,lq.[field_value]
ย  ย  ,lp.[value]
ย  ย  ,lp.[short]
ย  ย  ,lp.[index]
ย  ย  ,lp.[category]
ย  ย  ,lp.[export]
ย  ย  ,lp.[export2]
ย  ย  ,lp.[export3]
ย  ย  ,lp.[export4]
ย  ย  ,lp.[export5]
ย  ย  ,lp.[active]
FROM [query.part] qp
INNER JOIN [lookup.query] lq
ย  ย  ON lq.[id] = qp.[source]
ย  ย  ย  ย  OR lq.[id] = qp.[parent]
LEFT JOIN [lookup.prompt] lp
ย  ย  ON lp.[key] = lq.[field_prompt]
WHERE 1 = 1
ย  ย  AND qp.[type] = 'export'
ย  ย  AND qp.[query] = '6768b9a9-1839-44af-b5a4-605b0a9ab667'
ORDER BY qp.[order]
ย  ย  ,lp.[order]