cancel
Showing results for 
Search instead for 
Did you mean: 

How to get Property from EntityType in ODATA

Former Member
0 Kudos

HI Experts,

How i can get value of property from a entitytype in ODATA.

sample ODATA:

<EntityType Name="MyDataOverview" sap:content-version="1">

<Key>

<PropertyRef Name="ID"/>

</Key>

<Property Name="count" Type="Edm.String" Nullable="false" sap:rbShowValueText="false" sap:label="count" sap:creatable="false" sap:updatable="false" sap:filterable="false"/>

<Property Name="text" Type="Edm.String" Nullable="false" MaxLength="30" sap:rbShowValueText="false" sap:label="text" sap:creatable="false" sap:updatable="false" sap:filterable="false"/>

<Property Name="key" Type="Edm.Int32" " sap:rbShowValue="false" sap:label="key" sap:creatable="false" sap:updatable="false" sap:filterable="false"/>

</EntityType>

I tried this {/MyDataOverviewSet/count}, but its not working.

Can you please help on this.

thanks,

Sandeep

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Please give a wider context of your usage.

OData is not designed for fetching a property value of an entity type as you may think you want.

Each entity type is encapsulated in an entity set and identified by an unique key. The first part of your sample is telling that the property with the name "ID" is the key. But no property with a name like that exists so no entity type is addressable in your example.

Assuming your key property "key" is the key and you would like to fetch the value of property "count" directly from your ODataModel:


var value = oModel.getProperty("/MyDataOverviewSet(<ValueOfPropertyKey>)/count");

Greetz

Silvio

Former Member
0 Kudos

Hi Silvio,

Thanks for your reply.

I am working on  IconTab bar (SAPUI5 Explored)control and using ODATA to set the count value.

The ODATA entityset for seting count is ,

<EntityType Name="MyDataOverview" sap:content-version="1">

<Key>

<PropertyRef Name="Id"/>

</Key>

<Property Name="Id" Type="Edm.String" Nullable="false"  sap:rbShowValueText="false" sap:label="ID for Odata" sap:creatable="false" sap:updatable="false" sap:filterable="false"/>

<Property Name="CompleteText" Type="Edm.String" Nullable="false" MaxLength="30"  sap:rbShowValueText="false" sap:label="Completed" sap:creatable="false" sap:updatable="false" sap:filterable="false"/>

<Property Name="completeCount" Type="Edm.Int32"  sap:rbShowValue="false" sap:label="Count Complted" sap:creatable="false" sap:updatable="false" sap:filterable="false"/>

<Property Name="InProgressText" Type="Edm.String" Nullable="false" MaxLength="30"  sap:rbShowValueText="false" sap:label="In Progress" sap:creatable="false" sap:updatable="false" sap:filterable="false"/>

<Property Name="InProgressCount" Type="Edm.Int32"  sap:rbShowValue="false" sap:label="Count InProgress" sap:creatable="false" sap:updatable="false" sap:filterable="false"/>

<Property Name="FailedText" Type="Edm.String" Nullable="false" MaxLength="30"  sap:rbShowValueText="false" sap:label="Failed" sap:creatable="false" sap:updatable="false" sap:filterable="false"/>

<Property Name="FailedCount" Type="Edm.Int32"  sap:rbShowValue="false" sap:label="Count Failed" sap:creatable="false" sap:updatable="false" sap:filterable="false"/>

</EntityType>

How I can set the completeCount to count property of IconTab bar in View

Thanks,

Sandeep

Chantele
Active Participant
0 Kudos

try

{MyDataOverviewSet>count}