GENERIC_MODEL_LINK

A GenericModelLink field references (or "links to") any model level in the database. As such, it needs configuration to identify which model levels it might display, and for which model levels the user can provide a value.

To configure a GenericModelLink field either in filter or retrieval criteria, set the field type as COMPOSITE. Also, add all its components (id, model level and display) just like you would for a COMPOSITE field type.

What follows is an example of configuring a GENERIC_MODEL_LINK filter.

The filter should be defined as follows. Note how all fields except for the GML itself are marked as hidden.

<CustomFilterField>
<FieldRef levelType="PTA.TestModel" category="PDF">
<FieldName>TestGmlId</FieldName>
</FieldRef>
<Hidden>true</Hidden>
<Type>LONG</Type>
<SimpleMapping sqlName="TEST_GML_ID"/>
</CustomFilterField>
 
<CustomFilterField>
<FieldRef levelType="PTA.TestModel" category="PDF">
<FieldName>TestGmlModelLevel</FieldName>
</FieldRef>
<Hidden>true</Hidden>
<Type>STRING</Type>
<SimpleMapping sqlName="TEST_GML_MODEL_LEVEL"/>
</CustomFilterField>
 
<CustomFilterField>
<FieldRef levelType="PTA.TestModel" category="PDF">
<FieldName>TestGmlDisplay</FieldName>
</FieldRef>
<Hidden>true</Hidden>
<Type>STRING</Type>
<SimpleMapping sqlName="TEST_GML_DISPLAY"/>
</CustomFilterField>
 
<CustomFilterField>
<FieldRef levelType="PTA.TestModel" category="PDF">
<FieldName>TestGml</FieldName>
</FieldRef>
<Hidden>false</Hidden>
<Type>COMPOSITE</Type>
<CompositeFieldType name="GenericModelLink">
<Component name="TestGmlId" type="LONG"/>
<Component name="TestGmlModelLevel" type="STRING"/>
<Component name="TestGmlDisplay" type="STRING"/>
</CompositeFieldType>
</CustomFilterField>

Then, you can include the GenericModelLink component columns in the where clause part of the SQL as requied by your query:

and ${filterIfNotNull:TEST_GML_ID,test_GML_ID = $TEST_GML_ID$}
and ${filterIfNotNull:TEST_GML_MODEL_LEVEL,test_GML_MODEL_LEVEL = $TEST_GML_MODEL_LEVEL$}
and ${filterIfNotNull:TEST_GML_DISPLAY,test_GML_DISPLAY = $TEST_GML_DISPLAY$}

You will also need to add a JS plugin to configure the GenericModelLink field for the supported models.

define(function(){
Ext.ns('PTA');
PTA.GenericModelLinkReportPlugin = Ext.extend(Object, {
init : function(report){
report.on('filterscreated', function(r, staticFilters, dynamicFilters) {
var genericMlmodelLevelField = staticFilters.getField('PTA$TestModel$TestGml')
genericMlmodelLevelField.variants = [ {
"modelLevelType": "Site",
config: {
pickerReport: {
reportName: 'PTA.SitePickerReport',
fieldType: 'MODEL_LINK',
targetLevelType: 'Site'
}
}
}, {
"modelLevelType": "Item",
config: {
pickerReport: {
reportName: 'PTA.ItemPickerReport',
fieldType: 'MODEL_LINK',
targetLevelType: 'Item'
}
}
}];
 
});
}
});
 
});

images/download/attachments/144835574/GenericModelLink_Filters-version-1-modificationdate-1645045994000-api-v2.png
What follows is an example of retrieval configuration for a GENERIC_MODEL_LINK field.

The retrieval should be defined as follows:

<CustomRetrievalField>
<FieldRef levelType="PTA.TestModel" category="PDF">
<FieldName>TestGmlId</FieldName>
</FieldRef>
<Hidden>true</Hidden>
<Type>LONG</Type>
<SimpleMapping sqlName="TEST_GML_ID"/>
</CustomRetrievalField>
 
<CustomRetrievalField>
<FieldRef levelType="PTA.TestModel" category="PDF">
<FieldName>TestGmlModelLevel</FieldName>
</FieldRef>
<Hidden>true</Hidden>
<Type>STRING</Type>
<SimpleMapping sqlName="TEST_GML_MODEL_LEVEL"/>
</CustomRetrievalField>
 
<CustomRetrievalField>
<FieldRef levelType="PTA.TestModel" category="PDF">
<FieldName>TestGmlDisplay</FieldName>
</FieldRef>
<Hidden>true</Hidden>
<Type>STRING</Type>
<SimpleMapping sqlName="TEST_GML_DISPLAY"/>
</CustomRetrievalField>
 
<CustomRetrievalField>
<FieldRef levelType="PTA.TestModel" category="PDF">
<FieldName>TestGml</FieldName>
</FieldRef>
<Type>COMPOSITE</Type>
<Sortable>true</Sortable>
<CompositeFieldType name="GenericModelLink">
<Component name="TestGmlId" type="LONG" />
<Component name="TestGmlModelLevel" type="STRING"/>
<Component name="TestGmlDisplay" type="STRING"/>
</CompositeFieldType>
<SimpleMapping sqlName="TEST_GML_ID"/>
</CustomRetrievalField>

Then, include the GenericModelLink component columns in the select clause.

SELECT TEST_GML_ID,TEST_GML_MODEL_LEVEL,TEST_GML_DISPLAY FROM PTA_TEST_MODEL

images/devnet.onenetwork.com/oms/apps/DeveloperNetwork/www/docs/guides/SdkUsersGuide/help/content/img/Reports/GenericModelLink_Retrievals.png