Smart Filter Bar does not appear - sapui5

I am trying to use SmartFilterBar as follows:
<VBox fitContainer="true">
<smartFilterBar:SmartFilterBar id="JobProfileOverviewFilter" entitySet="ProfileSet">
<smartFilterBar:controlConfiguration>
<smartFilterBar:ControlConfiguration key="Item"></smartFilterBar:ControlConfiguration>
</smartFilterBar:controlConfiguration>
<smartFilterBar:layoutData>
<FlexItemData shrinkFactor="0"/>
</smartFilterBar:layoutData>
</smartFilterBar:SmartFilterBar>
<smartTable:SmartTable id="JobProfileOverview" entitySet="ProfileSet" tableType="ResponsiveTable" useTablePersonalisation="true"
showRowCount="true" enableAutoBinding="true" smartFilterId="JobProfileOverviewFilter" header="Business profiles"
class="sapUiResponsiveContentPadding" app:useSmartToggle="true">
<smartTable:customToolbar>
<OverflowToolbar design="Transparent">
<ToolbarSpacer/>
<OverflowToolbarButton icon="sap-icon://order-status" tooltip="Order status" text="Order status" press="onStatus"/>
</OverflowToolbar>
</smartTable:customToolbar>
<!-- layout data used to make the table growing but the filter bar fixed -->
<smartTable:layoutData>
<FlexItemData growFactor="1" baseSize="0%"/>
</smartTable:layoutData>
<Table mode="MultiSelect"></Table>
</smartTable:SmartTable>
</VBox>
The problem is, the filter does not appear on the screen.
the cutout from the metadata:
<EntityType Name="Profile" sap:content-version="1">
<Key>
<PropertyRef Name="ItemId"/>
</Key>
<Property Name="Item" Type="Edm.String" Nullable="false" MaxLength="300" sap:unicode="false" sap:label="Role" sap:creatable="false"
sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="Connector" Type="Edm.String" Nullable="false" MaxLength="32" sap:unicode="false" sap:label="System" sap:creatable="false"
sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="Descn" Type="Edm.String" Nullable="false" sap:unicode="false" sap:label="Description" sap:creatable="false"
sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="ValidFrom" Type="Edm.DateTime" Nullable="false" Precision="7" sap:unicode="false" sap:label="Valid From"
sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="ValidTo" Type="Edm.DateTime" Nullable="false" Precision="7" sap:unicode="false" sap:label="Valid To" sap:creatable="false"
sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="Status" Type="Edm.String" Nullable="false" MaxLength="8" sap:unicode="false" sap:label="Expiration Status"
sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="Selected" Type="Edm.String" Nullable="false" MaxLength="1" sap:unicode="false" sap:label="Boolean" sap:creatable="false"
sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="ItemId" Type="Edm.String" Nullable="false" MaxLength="50" sap:unicode="false" sap:label="Object ID" sap:creatable="false"
sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="ItemType" Type="Edm.String" Nullable="false" MaxLength="6" sap:unicode="false" sap:label="Item Type" sap:creatable="false"
sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
</EntityType>
<EntitySet Name="ProfileSet" EntityType="YGAC_ACCESS_MANAGER_SRV.Profile" sap:creatable="false" sap:updatable="false" sap:deletable="false"
sap:pageable="false" sap:content-version="1"/></EntityContainer>
What am I doing wrong?
Update
I have enabled the filter now
But it does not appear in SmartFilter:
I have to enable it in the filter option:
Why the filter fields do not get shown as default?

Try to add other parameters, for example:
<smartFilterBar:ControlConfiguration
key="Item"
mandatory="auto"
preventInitialDataFetchInValueHelpDialog="false"
visibleInAdvancedArea="true"
controlType="auto"
displayBehaviour="idAndDescription"
label="Item"
index="1"></smartFilterBar:ControlConfiguration>

Related

Cant seem to connect oData table to a smart table

I was trying to connect an oData table to a smart table in my web ide using the following code.
I have seen the metadata of my oData and the entity set I want to access is trainingPlan.
PLANID and COURSEID are 2 columns in the table I am accessing.
In the result screen just the empty toolbar is coming and 'no data' is written beneath it.
The table is accessible as I tried to display using normal table and the data is showing.
#App.view.xml
<core:View xmlns:core="sap.ui.core" xmlns="sap.m" xmlns:smartFilterBar="sap.ui.comp.smartfilterbar"
xmlns:smartTable="sap.ui.comp.smarttable" xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:app="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1" controllerName="Workspace.controller.App" height="100%">
<smartFilterBar:SmartFilterBar id="smartFilterBar" entitySet="trainingPlan" persistencyKey="SmartFilter_Explored" enableBasicSearch="true" >
<smartFilterBar:controlConfiguration>
<smartFilterBar:ControlConfiguration key="PLANID"></smartFilterBar:ControlConfiguration>
<smartFilterBar:ControlConfiguration key="COURSEID"></smartFilterBar:ControlConfiguration>
</smartFilterBar:controlConfiguration>
</smartFilterBar:SmartFilterBar>
<smartTable:SmartTable entitySet="trainingPlan" initiallyVisibleFields="PLANID" smartFilterId="smartFilterBar" tableType="ResponsiveTable" useExportToExcel="true"
useVariantManagement="false" useTablePersonalisation="true" header="Line Items" showRowCount="true" tableBindingPath="{TEST>/trainingPlan}"
persistencyKey="SmartTableAnalytical_Explored" enableAutoBinding="true" demandPopin="true" class="sapUiResponsiveContentPadding"
/>
</core:View>
#metadata.xml
<edmx:Edmx xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"
Version="1.0">
<edmx:DataServices
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
m:DataServiceVersion="2.0">
<Schema xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns="http://schemas.microsoft.com/ado/2008/09/edm"
Namespace="demo.services.demo">
<<EntityType Name="trainingPlanType">
<Key>
<PropertyRef Name="PLANID"/>
<PropertyRef Name="COURSEID"/>
</Key>
<Property Name="PLANID" Type="Edm.Int32" Nullable="false"/>
<Property Name="COURSEID" Type="Edm.Int32" Nullable="false"/>
<Property Name="COURSENAME" Type="Edm.String" Nullable="false"
MaxLength="255"/>
<Property Name="STARTDATE" Type="Edm.DateTime" Nullable="false"/>
<Property Name="AVAILSEAT" Type="Edm.Int32" Nullable="false"/>
<Property Name="TOTALSEATS" Type="Edm.Int32" Nullable="false"/>
<Property Name="ROOMNO" Type="Edm.Int32" Nullable="false"/>
<Property Name="COURSEDURATION" Type="Edm.String" MaxLength="255"/>
</EntityType>
<EntityContainer Name="demo" m:IsDefaultEntityContainer="true">
<EntitySet Name="trainingPlan"
EntityType="demo.services.demo.trainingPlanType"/>
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx>
I assume you used a model named "TEST".
If you obtain the OData service data through the manifest without a named model, change tableBindingPath to:
tableBindingPath="{/trainingPlan}"

How to use smartfilterbar and smarttable?

I have EntitySet and would like to connect to SmartFilterBar and SmartTable. The EntitySet looks like:
<EntitySet Name="I_PMContactCardEmployee" EntityType="EAM_MALFUNCTION_MANAGE.I_PMContactCardEmployeeType" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:searchable="true" sap:content-version="1"/>
The EntityType:
<EntityType Name="I_PMContactCardEmployeeType" sap:label="Mitarbeiter" sap:content-version="1">
<Key>
<PropertyRef Name="PersonnelNumber"/>
</Key>
<Property Name="PersonnelNumber" Type="Edm.String" Nullable="false" MaxLength="8" sap:display-format="NonNegative" sap:text="EmployeeFullName" sap:label="Personalnummer"/>
<Property Name="EmployeeFullName" Type="Edm.String" MaxLength="80" sap:label="Vollständiger Name" sap:filterable="false"/>
<Property Name="FirstName" Type="Edm.String" MaxLength="40" sap:label="Vorname" sap:quickinfo="Vorname des Geschäftspartners (Person)"/>
<Property Name="FamilyName" Type="Edm.String" MaxLength="40" sap:label="Nachname" sap:quickinfo="Nachname des Geschäftspartners (Person)"/>
<Property Name="Job" Type="Edm.String" MaxLength="8" sap:display-format="NonNegative" sap:label="Stellenschlüssel" sap:quickinfo="Stelle" sap:filterable="false"/>
<Property Name="JobName" Type="Edm.String" MaxLength="25" sap:label="Stellenbezeichnung" sap:filterable="false"/>
<Property Name="CompanyCode" Type="Edm.String" MaxLength="4" sap:display-format="UpperCase" sap:text="CompanyCodeName" sap:label="Buchungskreis"/>
<Property Name="CompanyCodeName" Type="Edm.String" MaxLength="25" sap:label="Name der Firma" sap:quickinfo="Buchungskreis- oder Firmen-Bezeichnung" sap:filterable="false"/>
<Property Name="OrganizationalUnit" Type="Edm.String" MaxLength="8" sap:display-format="NonNegative" sap:label="Organisationseinheit"/>
<Property Name="OrganizationalUnitName" Type="Edm.String" MaxLength="25" sap:label="OrgEinheitenkurztext" sap:quickinfo="Organisationseinheitenkurztext" sap:filterable="false"/>
<Property Name="PhoneNumber" Type="Edm.String" MaxLength="30" sap:display-format="UpperCase" sap:label="Telefon" sap:quickinfo="Telefonnummer: Vorwahl+Anschluß" sap:filterable="false"/>
<Property Name="NormalizedPhoneNumber" Type="Edm.String" MaxLength="30" sap:display-format="UpperCase" sap:label="Telefonnummer" sap:quickinfo="Vollständige Nummer: Vorwahl+Anschluß+Durchwahl" sap:filterable="false"/>
<Property Name="MobilePhoneNumber" Type="Edm.String" MaxLength="30" sap:display-format="UpperCase" sap:label="Telefon" sap:quickinfo="Telefonnummer: Vorwahl+Anschluß" sap:filterable="false"/>
<Property Name="MblNormalizedPhoneNumber" Type="Edm.String" MaxLength="30" sap:display-format="UpperCase" sap:label="Telefonnummer" sap:quickinfo="Vollständige Nummer: Vorwahl+Anschluß+Durchwahl" sap:filterable="false"/>
<Property Name="DefaultEmailAddress" Type="Edm.String" MaxLength="241" sap:label="E-Mail-Adresse"/>
<Property Name="UserID" Type="Edm.String" MaxLength="12" sap:display-format="UpperCase" sap:label="Benutzer-ID" sap:filterable="false"/>
</EntityType>
and the view looks like:
<smartFilterBar:SmartFilterBar id="smartFilterBar" entitySet="malfunc>I_PMContactCardEmployee" persistencyKey="SmartFilterPKey">
<smartFilterBar:controlConfiguration>
<smartFilterBar:ControlConfiguration key="PersonnelNumber" visibleInAdvancedArea="true" preventInitialDataFetchInValueHelpDialog="false"></smartFilterBar:ControlConfiguration>
</smartFilterBar:controlConfiguration>
</smartFilterBar:SmartFilterBar>
<smartTable:SmartTable id="smartTable_ResponsiveTable" smartFilterId="smartFilterBarr" tableType="ResponsiveTable" editable="false"
entitySet="malfunc>I_PMContactCardEmployee" useVariantManagement="true" useTablePersonalisation="true" header="Products" showRowCount="true"
useExportToExcel="false" enableAutoBinding="true" persistencyKey="SmartTablePKey"></smartTable:SmartTable>
the service is registered as:
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"settings": {
"bundleName": "example.com.smartemployee.i18n.i18n"
}
},
"malfunc": {
"uri": "/sap/opu/odata/sap/EAM_MALFUNCTION_MANAGE/",
"type": "sap.ui.model.odata.v2.ODataModel",
"settings": {
"defaultOperationMode": "Server",
"defaultBindingMode": "OneWay",
"defaultCountMode": "Request"
},
"dataSource": "EAM_MALFUNCTION_MANAGE",
"preload": true
}
},
to get the data from the service, in the postman I called:
and get all of employees.
When I execute the application, SmartFilterBar and SmartTable is not working correctly.
It shows just an empty filterbar. What am I doing wrong?
As far as I know it is better to define the ODataModel as the default model.
"malfunc": {
"uri": "/sap/opu/odata/sap/EAM_MALFUNCTION_MANAGE/",
"type": "sap.ui.model.odata.v2.ODataModel",
"settings": {
"defaultOperationMode": "Server",
"defaultBindingMode": "OneWay",
"defaultCountMode": "Request"
},
"dataSource": "EAM_MALFUNCTION_MANAGE",
"preload": true
}
Also, assuming that your EntitySet is called "I_PMContactCardEmployeeSet", you have to specifiy that EntitSet in the SmartFilterBar and SmartTable properties:
entitySet="I_PMContactCardEmployeeSet"

SAPUI5 - Change the Column Name and Properties from smarttable from oData with no Annotation

I'm developing a SAPUI5 application that's use a smart table component. But the oData provided does not send any annotations in the metatdata file. I'm starting selecting these fields from oData: PriorityName,OrderTypeType,OrderTypeName,Id,DateOpen,HourOpen,BrandName,EquipmentId,EquipmentNumber,SymptomName. But i want to show their as Priority Name, Order Type, Order Type Name, Id, Date Open, Hour Open, Brand Name, Equipment Id, Equipment Number and Symptom Name, respective, in table column header and p13ndialog.
I know that is changed by default in the sap:label property in Property Name tag under EntityType. But according the oData developer, they cant send it to me (He was using JPA and oLingo).
The code above is for my smarttable and the entity used in metadada.
<smartTable:SmartTable entitySet="CustomerOrders" id="tbOrders" tableType="Table" useExportToExcel="true" beforeExport="onBeforeExport"
header="Ordens de Manutenção" showRowCount="true" enableAutoBinding="true" beforeRebindTable="onBeforeRebindTable"
initiallyVisibleFields="PriorityName,OrderTypeType,OrderTypeName,Id,DateOpen,HourOpen,BrandName,EquipmentId,EquipmentNumber,SymptomName"
class="sapUiResponsiveContentPadding">
<smartTable:customToolbar>
<OverflowToolbar design="Transparent">
<ToolbarSpacer/>
<OverflowToolbarButton icon="sap-icon://sort" text="Sort" press="onSort"/>
<OverflowToolbarButton icon="sap-icon://filter" text="Filter" press="onFilter"/>
</OverflowToolbar>
</smartTable:customToolbar>
<table:Table id="innerUi5Table" growing="true" selectionMode="None" visibleRowCountMode="Auto">
<table:rowSettingsTemplate>
<table:RowSettings highlight="{ path: 'PriorityName', formatter: '.formatter.OrderStatusFormatter' }"/>
</table:rowSettingsTemplate>
</table:Table>
</smartTable:SmartTable>
Metadata
<EntityType Name="CustomerOrder">
<Key>
<PropertyRef Name="Id"/>
</Key>
<Property Name="BrandName" Type="Edm.String" Nullable="true" MaxLength="150"/>
<Property Name="City" Type="Edm.String" Nullable="true" MaxLength="45"/>
<Property Name="ContactFirstname" Type="Edm.String" Nullable="true" MaxLength="45"/>
<Property Name="ContactLastname" Type="Edm.String" Nullable="true" MaxLength="45"/>
<Property Name="Country" Type="Edm.String" Nullable="true" MaxLength="2"/>
<Property Name="CustomerId" Type="Edm.Int64" Nullable="true"/>
<Property Name="DateOpen" Type="Edm.DateTime" Nullable="true"/>
<Property Name="EquipmentId" Type="Edm.String" Nullable="true" MaxLength="10"/>
<Property Name="EquipmentNumber" Type="Edm.String" Nullable="true" MaxLength="12"/>
<Property Name="EquipmentType" Type="Edm.String" Nullable="true" MaxLength="40"/>
<Property Name="FantasyName" Type="Edm.String" Nullable="true" MaxLength="45"/>
<Property Name="HourOpen" Type="Edm.Time" Nullable="true"/>
<Property Name="Id" Type="Edm.Int64" Nullable="false"/>
<Property Name="Latitude" Type="Edm.String" Nullable="true" MaxLength="12"/>
<Property Name="Longitude" Type="Edm.String" Nullable="true" MaxLength="12"/>
<Property Name="ManufacturerSerialNumber" Type="Edm.String" Nullable="true" MaxLength="255"/>
<Property Name="Material" Type="Edm.String" Nullable="true" MaxLength="8"/>
<Property Name="Neighborhood" Type="Edm.String" Nullable="true" MaxLength="45"/>
<Property Name="Note" Type="Edm.String" Nullable="true" MaxLength="10"/>
<Property Name="Obs" Type="Edm.String" Nullable="true" MaxLength="150"/>
<Property Name="OrderTypeId" Type="Edm.String" Nullable="true" MaxLength="4"/>
<Property Name="OrderTypeName" Type="Edm.String" Nullable="true" MaxLength="45"/>
<Property Name="OrderTypeType" Type="Edm.String" Nullable="true" MaxLength="45"/>
<Property Name="OsImbera" Type="Edm.String" Nullable="true" MaxLength="8"/>
<Property Name="Phone" Type="Edm.String" Nullable="true" MaxLength="11"/>
<Property Name="Plant" Type="Edm.String" Nullable="true" MaxLength="4"/>
<Property Name="PriorityId" Type="Edm.Int32" Nullable="true"/>
<Property Name="PriorityName" Type="Edm.String" Nullable="true" MaxLength="15"/>
<Property Name="State" Type="Edm.String" Nullable="true" MaxLength="2"/>
<Property Name="Status" Type="Edm.String" Nullable="true" MaxLength="1"/>
<Property Name="Street" Type="Edm.String" Nullable="true" MaxLength="150"/>
<Property Name="SymptomId" Type="Edm.Int64" Nullable="true"/>
<Property Name="SymptomName" Type="Edm.String" Nullable="true" MaxLength="45"/>
<Property Name="SymptomObjTecnico" Type="Edm.String" Nullable="true" MaxLength="10"/>
<Property Name="SymptomSAP" Type="Edm.String" Nullable="true" MaxLength="8"/>
<Property Name="TechnicalObjName" Type="Edm.String" Nullable="true" MaxLength="255"/>
<Property Name="WarrantyObs" Type="Edm.String" Nullable="true" MaxLength="45"/>
<Property Name="WorkCenter" Type="Edm.String" Nullable="true" MaxLength="8"/>
<Property Name="Zipcode" Type="Edm.String" Nullable="true" MaxLength="9"/>
</EntityType>
Redefine the rows/columns in your XML manually and bind your labels against i18n model, where you can define all the needed labels.
The bad thing about it - you cannot influence on the columns that potentially could be added via personalisation. Possible workaround - redefine ALL the columns. But in this case once the backend get changed, you have to adjust UI accordingly.

SAPUI5 - mockup server

I'm following this Mockup Server tutorial for SAPUI5. But I'm not able to retrieve the data and set it to my model. Here's what I do:
I have slightly changed the data so, so two things have to be changed:
json data - Person.json:
{ "id":1,
"first_name":"Chris",
"last_name":"Johnston", "email":"cjohnston0#dailymotion.com", "gender":"Male", "ip_address":"119.220.205.173" }
emphasized text
``
<edmx:Edmx Version="1.0"
xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"/>
<edmx:DataServices m:DataServiceVersion="1.0"
m:MaxDataServiceVersion="3.0">
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<Schema Namespace="PersonsData" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
<EntityType Name="Person">
<Key>
<PropertyRef Name="id"/>
</Key>
<Property name="id" Type="Edm.Int16" Nullable="false" />
<Property Name="first_name" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true"/>
<Property Name="last_name" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true"/>
<Property Name="email" Type="Edm.String" Nullable="false"/>
<Property Name="gender" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false"/>
<Property Name="ip_address" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true"/>
</EntityType>
</Schema>
<Schema Namespace="databinding.PersonsData.Model" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
<EntityContainer Name="PersonEntities" m:IsDefaultEntityContainer="true" p6:LazyLoadingEnabled="true"
xmlns:p6="http://schemas.microsoft.com/ado/2009/02/edm/annotation">
<EntitySet Name="Persons" EntityType="PersonsData.Invoice"/>
</EntityContainer>
</Schema>
</edmx:DataServices>
The SAPUI5 Web IDE says that edmx namespace does not exist.
So I went to check edmx namespace and it does not exists.
Chrome developer tools reports the same error:
Could this be the problem?
I checked and mockserver.init() is triggered.
Did Microsoft moved this namespace somewhere? Cause I was not able to find it.
Thanks
what I see is that you messed up your XML structure. As the error says your XML is invalid.
You've closed the surrounding edmx:Edmx tag at the beginning of the document
You've closed the edmx:DataServices tag too early
Furthermore the attribute name of the property id is in lowercase. Try to make an uppercased Name.
Try to use this xml:
<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">
<edmx:DataServices m:DataServiceVersion="1.0" m:MaxDataServiceVersion="3.0"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<Schema Namespace="PersonsData" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
<EntityType Name="Person">
<Key>
<PropertyRef Name="id"/>
</Key>
<Property Name="id" Type="Edm.Int16" Nullable="false"/>
<Property Name="first_name" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true"/>
<Property Name="last_name" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true"/>
<Property Name="email" Type="Edm.String" Nullable="false"/>
<Property Name="gender" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false"/>
<Property Name="ip_address" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true"/>
</EntityType>
</Schema>
<Schema Namespace="databinding.PersonsData.Model" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
<EntityContainer Name="PersonEntities" m:IsDefaultEntityContainer="true" p6:LazyLoadingEnabled="true"
xmlns:p6="http://schemas.microsoft.com/ado/2009/02/edm/annotation">
<EntitySet Name="Persons" EntityType="PersonsData.Invoice"/>
</EntityContainer>
</Schema>
</edmx:DataServices>

How does odata know which property is the ID?

In the following example russelwhyte is the id, but how does the provider know to map it to the UserName property?
URL: http://services.odata.org/V4/TripPinServiceRW/People?$format=application/json;odata.metadata=full
Response:
{
#odata.context: "http://services.odata.org/V4/(S(ck3fzk3dze0kmzjcruxiz31i))/TripPinServiceRW/$metadata#People",
#odata.nextLink: "http://services.odata.org/V4/TripPinServiceRW/People?%24format=application%2fjson%3bodata.
metadata%3dfull&%24skiptoken=8",
value:
[
{
#odata.type: "#Microsoft.OData.SampleService.Models.TripPin.Person",
#odata.id: "http://services.odata.org/V4/TripPinServiceRW/People('russellwhyte')",
#odata.etag: "W/"08D17DBDFB9CCAAC"",
#odata.editLink: "http://services.odata.org/V4/TripPinServiceRW/People('russellwhyte')",
UserName: "russellwhyte",
FirstName: "Russell",
LastName: "Whyte",
...
Friends#odata.associationLink: "http://services.odata.org/V4/TripPinServiceRW/People('russellwhyte')/Friends/$ref",
Friends#odata.navigationLink: "http://services.odata.org/V4/TripPinServiceRW/People('russellwhyte')/Friends",
...
},
...
]
}
By overriding GetEntityByKey of the base class EntitySetController
Query the metadata document, you can get the model schema for the service, and in which you can find which properties are the keys/IDs.
For example:
GET: http://services.odata.org/V4/(S(ksn5grnrgbebt44osly5z2vr))/TripPinServiceRW/$metadata
<EntityType Name="Person" OpenType="true">
<Key>
<PropertyRef Name="UserName"/>
</Key>
<Property Name="UserName" Type="Edm.String" Nullable="false">
<Annotation Term="Org.OData.Core.V1.Permissions">
<EnumMember>Org.OData.Core.V1.Permission/Read</EnumMember>
</Annotation>
</Property>
<Property Name="FirstName" Type="Edm.String" Nullable="false"/>
<Property Name="LastName" Type="Edm.String" Nullable="false"/>
<Property Name="Emails" Type="Collection(Edm.String)"/>
<Property Name="AddressInfo" Type="Collection(Microsoft.OData.SampleService.Models.TripPin.Location)"/>
<Property Name="Gender" Type="Microsoft.OData.SampleService.Models.TripPin.PersonGender"/>
<Property Name="Concurrency" Type="Edm.Int64" Nullable="false">
<Annotation Term="Org.OData.Core.V1.Computed" Bool="true"/>
</Property>
<NavigationProperty Name="Friends" Type="Collection(Microsoft.OData.SampleService.Models.TripPin.Person)"/>
<NavigationProperty Name="Trips" Type="Collection(Microsoft.OData.SampleService.Models.TripPin.Trip)" ContainsTarget="true"/>
<NavigationProperty Name="Photo" Type="Microsoft.OData.SampleService.Models.TripPin.Photo"/>
</EntityType>