PDMPageQuery
This is the main template used to populate the query-generated pages in the customer-facing PDMs. It calls the equivalents of the Template:PDMTable, Template:PDMView, Template:PDMs_SubjectArea, and Template:PDMSchema templates for the table, view, and subject area pages, respectively. It switches for the various types of pages, with separate Cargo queries (which, in turn, call various formatting templates, some with further sub-queries) to populate table (Template:PDMTablePageFormat), schema (Template:PDMSchemaPageFormat), view (Template:PDMViewPageFormat), subject area (Template:PDMSubjAreaPageFormat), and any list pages that don't need surrounding text. The default is to transclude the equivalent Library book page.
The transclusion part of the template accepts an optional |doc parameter, to specify a non-Library manual as the transclusion source.
Content is:
{{#switch:{{#explode:{{#explode:{{FULLPAGENAME}}|:|3}}|-|0}}
|Table=<!-- Query to populate Table pages-->
{{#cargo_query:
tables=PDMTable
|fields=_pageName=pageName,tableName=tableName,tableDesc=tableDesc,subjectAreas=subjectAreas,dbSchema=dbSchema,introduced=introduced,modified=modified,discontinued=discontinued,tableGroup=group,dataExport=dataExport,partitioned=partitioned,CONCAT('{{FULLPAGENAME}}')=page
|where=_pageName LIKE "{{#if:{{{source|}}}|{{{source}}}|Documentation:{{#switch:{{#explode:{{FULLPAGENAME}}|:|1}}|PSAAS=GIM:Library:{{#explode:{{FULLPAGENAME}}|:|3}}:{{#switch:{{#explode:{{FULLPAGENAME}}|:|4}}|draft=DRAFT|Public=PDMSource}}
|#default={{#explode:{{FULLPAGENAME}}|:|1}}:Library:{{anchorencode:{{#explode:{{FULLPAGENAME}}|:|3}}}}:{{#switch:{{lc:{{#sub:{{FULLPAGENAME}}|-5}}}}|draft|ource={{#explode:{{FULLPAGENAME}}|:|4}}|#default={{#switch:{{lc:{{#explode:{{FULLPAGENAME}}|:|4}}}}|public|current=PDMSource|#default={{#sub:{{#explode:{{FULLPAGENAME}}|:|4}}|0|3}}PDMSource}}}}}}}}"
|format=template
|template=PDMTablePageFormat
|default=This table is reserved.
|named args=yes
}}
|Schema=<!--Query to populate Schema pages-->
{{#cargo_query:
tables=PDMSchema
|fields=_pageName=pageName,schemaName=schemaName,schemaDesc=schemaDesc,priority=priority,diagram=diagram,caption=caption,diagramComment=diagramComment,CONCAT('{{FULLPAGENAME}}')=page
|where=_pageName LIKE "{{#if:{{{source|}}}|{{{source}}}|Documentation:{{#explode:{{FULLPAGENAME}}|:|1}}:Library:{{anchorencode:{{#explode:{{FULLPAGENAME}}|:|3}}}}:{{#switch:{{lc:{{#sub:{{FULLPAGENAME}}|-5}}}}|draft|ource={{#explode:{{FULLPAGENAME}}|:|4}}|#default={{#switch:{{lc:{{#explode:{{FULLPAGENAME}}|:|4}}}}|public|current=PDMSource|#default={{#sub:{{#explode:{{FULLPAGENAME}}|:|4}}|0|3}}PDMSource}}}}}}"
|format=template
|template=PDMSchemaPageFormat
|order by=priority
|named args=yes
}}
|View=<!-- Query to populate View pages-->
{{#cargo_query:
tables=PDMView
|fields=_pageName=pageName,viewName=viewName,viewDesc=viewDesc,subjectAreas=subjectAreas,introduced=introduced,modified=modified,discontinued=discontinued,dataExport=dataExport,SQLQuery=SQLQuery,CONCAT('{{FULLPAGENAME}}')=page
|where=_pageName LIKE "{{#if:{{{source|}}}|{{{source}}}|Documentation:{{#switch:{{#explode:{{FULLPAGENAME}}|:|1}}|PSAAS=GIM:Library:{{#explode:{{FULLPAGENAME}}|:|3}}:{{#switch:{{#explode:{{FULLPAGENAME}}|:|4}}|draft=DRAFT|Public=PDMSource}}
|#default={{#explode:{{FULLPAGENAME}}|:|1}}:Library:{{anchorencode:{{#explode:{{FULLPAGENAME}}|:|3}}}}:{{#switch:{{lc:{{#sub:{{FULLPAGENAME}}|-5}}}}|draft|ource={{#explode:{{FULLPAGENAME}}|:|4}}|#default={{#switch:{{lc:{{#explode:{{FULLPAGENAME}}|:|4}}}}|public|current=PDMSource|#default={{#sub:{{#explode:{{FULLPAGENAME}}|:|4}}|0|3}}PDMSource}}}}}}}}"
|format=template
|template=PDMViewPageFormat
|named args=yes
}}
|SubjArea=<!-- Query to populate Subject Area pages-->
{{#cargo_query:
tables=PDMs_SubjectArea
|fields=_pageName=pageName,subjectArea=subjectArea,description=description,diagram=diagram,CONCAT('{{FULLPAGENAME}}')=page
|where=_pageName LIKE "{{#if:{{{source|}}}|{{{source}}}|Documentation:{{#switch:{{#explode:{{FULLPAGENAME}}|:|1}}|PSAAS=GIM:Library:{{#explode:{{FULLPAGENAME}}|:|3}}:{{#switch:{{#explode:{{FULLPAGENAME}}|:|4}}|draft=DRAFT|Public=PDMSource}}
|#default={{#explode:{{FULLPAGENAME}}|:|1}}:Library:{{anchorencode:{{#explode:{{FULLPAGENAME}}|:|3}}}}:{{#switch:{{lc:{{#sub:{{FULLPAGENAME}}|-5}}}}|draft|ource={{#explode:{{FULLPAGENAME}}|:|4}}|#default={{#switch:{{lc:{{#explode:{{FULLPAGENAME}}|:|4}}}}|public|current=PDMSource|#default={{#sub:{{#explode:{{FULLPAGENAME}}|:|4}}|0|3}}PDMSource}}}}}}}}"
|format=template
|template=PDMSubjAreaPageFormat
|named args=yes
}}
|InfoMartReferences={{PDMRefQuery|page={{FULLPAGENAME}}}}
|#default=<!-- Default is to transclude the equivalent Library book page for the applicable version-->
{{Documentation:{{#switch:{{#explode:{{FULLPAGENAME}}|:|1}}|PSAAS=GIM|#default={{#explode:{{FULLPAGENAME}}|:|1}}}}:{{#if:{{{doc|}}}|{{{doc}}}|Library}}:{{#explode:{{FULLPAGENAME}}|:|3}}:{{#switch:{{lc:{{#explode:{{FULLPAGENAME}}|:|4}}}}|public|current={{#if:{{{doc|}}}|Current|PDMSource}}|{{#switch:{{lc:{{#sub:{{FULLPAGENAME}}|-5}}}}|draft={{#if:{{{doc|}}}|DRAFT|{{uc:{{#explode:{{FULLPAGENAME}}|:|4}}}}}}|#default={{#sub:{{#explode:{{FULLPAGENAME}}|:|4}}|0|3}}PDMSource}}}}}}
}}