Template: PDMRefQuery

From Genesys Documentation
Jump to: navigation, search

This template provides the query to populate the table of references on GIM Library Table and View pages, as well as the Reference List page in GIM. It is called by Template:PDMTable and Template:PDMTablePageFormat,Template:PDMViewPageFormat, and Template:PDMPageQuery. Note that, while RAA does capture PDMRef information, none of this information displays in the RAA PDMs.

This template has been modified from the one originally developed for Ponydocs. Since it no longer needs to cover ICON, some switches fall away. Use of REPLACE and SUBSTRING_INDEX functions simplifies construction of links to accommodate tables/views whose names end in an underscore but whose URLs don't. The where condition excludes CTL, etc. tables/views from the page in the cloud PDM.

Content is:

<!-- GIM needs to switch for Table/View pages vs. the Reference list -->
{{#switch:{{#explode:{{#explode:{{{page}}}|/|3}}|-|0}}
|Table
|View={{#cargo_query:
tables=PDMRef,PDMTable,PDMView
|join on=PDMRef._pageName=PDMTable._pageName,PDMRef._pageName=PDMView._pageName
|fields=IF( (PDMRef._pageName LIKE "%/Table-%"),REPLACE(PDMTable.tableName,"_","_<wbr/>"),REPLACE(PDMView.viewName,"_","_<wbr/>"))=Child Table/View,PDMRef.foreignKey=Child Table/View Column,IF( (PDMRef.parentTable IS NOT NULL),REPLACE(PDMRef.parentTable,"_","_<wbr/>"),REPLACE(PDMRef.parentView,"_","_<wbr/>"))=Parent Table/View,PDMRef.parentColumn=Parent Table/View Column
|where=PDMRef._pageName LIKE "{{{page}}}"
|default=There are no references from this table/view.
|format=sortable table
}}
|InfoMartReferences
|#default={{#cargo_query:
tables=PDMRef,PDMTable,PDMView
|join on=PDMRef._pageName=PDMTable._pageName,PDMRef._pageName=PDMView._pageName
|fields=IF( (PDMTable.tableName IS NOT NULL),CONCAT('[[',REPLACE("{{{page}}}","InfoMartReferences",SUBSTRING_INDEX(PDMRef._pageName,'/',-1)),'|',REPLACE(PDMTable.tableName,"_","_<wbr/>"),']]'),CONCAT('[[',REPLACE("{{{page}}}","InfoMartReferences",SUBSTRING_INDEX(PDMRef._pageName,'/',-1)),'|',REPLACE(PDMView.viewName,"_","_<wbr/>"),']]'))=ChildTable/ChildView,PDMRef.foreignKey=ChildTable/ChildView Column,IF( (PDMRef.parentTable IS NOT NULL),PDMRef.parentTable,PDMRef.parentView)=ParentTable/ParentView,IF( (PDMRef.parentColumn IS NOT NULL),PDMRef.parentColumn,'')=ParentTable/ParentView Column
|where=PDMRef._pageName LIKE "{{#if:{{{source|}}}|{{{source}}}|{{#switch:{{#explode:{{{page}}}|:|0}}|Draft=
Draft:PEC-REP/Library/PDMLibraryGIM/%%|#default=PEC-REP/Library/PDMLibraryGIM/%%}}}}" AND (PDMRef._pageName NOT LIKE "%CTL_%" OR PDMRef._pageName NOT LIKE "%STG_%" OR PDMRef._pageName NOT LIKE "%View-CDR%")
|format=dynamic table
|order by=ChildTable/ChildView
|rows per page=150
|limit=5000
}}
}}
Retrieved from "https://all.docs.genesys.com/Template:PDMRefQuery (2022-08-14 22:07:45)"