The sample Smart API shown here has the following inheritance scheme, shown logically, and then in $metadata:
Pipe (derives from) →Equipment (derives from) →PlantItem (derives from) →PbsItem
<EntityType Name="PbsItem" BaseType="Com.Ingr.Core.V1.DynamicEdmEntityObject"
<EntityType Name="PlantItem" BaseType="Com.Ingr.Core.V1.PbsItem"
Abstract="true" OpenType="true" />
<EntityType Name="Equipment" BaseType="Com.Ingr.Sppid.V1.PlantItem"
<EntityType Name="Pipe" BaseType="Com.Ingr.Sppid.V1.Equipment"
Typically, a client appends a type-cast URL segment to limit response data (based on a derived type). For example, to limit a query for PlantItems to Pipes:
PBI Desktop’s basic support for OData does not include using type-cast URL segments. However, you can use the connector SmartAPIOData.Typecast function to support OData typecasting.
This function must be used in the Advanced Editor by editing Power Query M language and including the typecast.
The following steps provide an overview:
After you connect to a Smart API, the Navigator dialog box shows all available OData entity sets.
Select an entity set that serves as a base type for other derived entity types and click Transform Data to load the Power Query Editor.
Certain Smart APIs use the multi-tenant pattern that exposes a single entity set at the service root, for example, Sites. In this case, you must navigate to the desired entity set after selecting and loading the single entity set.
You must be familiar with the inheritance scheme for the entities in the Smart API. See the specific Smart API $metadata document or API documentation for details.
In this example, the Sites/Plants/PlantItems entity set is used.
Click the View tab, and then Advanced Editor. The editor displays something similar to the following:
The query for the Sites/Plants/PlantItems navigation property collection stores the result in #"Plant A".
Modify the code in the Advanced Editor to typecast that result using the HexagonSmartApiOData.Typecast function.
Click Done. The table updates to display only Pipe derived types.