cancel
Showing results for 
Search instead for 
Did you mean: 

Fetch the first item's value of the list | oData v4, SapUi5 or OpenUi5

Former Member
0 Kudos

Currenet Ui5 Version used 1.46.12

What is Required?

Is to Fetch the first item's value "EventDate" of the list array which is received from the oData(v4) response.

View Code

<layout:VerticalLayout binding="{/Logs}">
    <Text text="Latest update"/>
    <Text id="LastUpdatedSynchronizeDateStringText"
          text="{EventDate}"/>
</layout> 

Batch request response (oData v4)

{
 "@odata.context":"http://localhost/odata/$metadata#Logs","value":[
    {
      "LogId":12512,"ErrText":"end","EventDate":"2017-05-11T07:10:44Z","Location":"OEN","Result":0
    }
  ]
}

Tried & Failed:

<Text id="Last..." text="{EventDate}"/>
<Text id="Last..." text="{0/EventDate}"/>
<Text id="Last..." text="{0.EventDate}"/>

Error message is "Failed to drill down"

Thank you

Saanvi S

Accepted Solutions (1)

Accepted Solutions (1)

vedaradhya
Participant
0 Kudos

Hi Sanvi,

In the code you didn't closed the <layout:VerticalLayout> tag properly,

binding to the first item of a collection, try some thing like shown below

<layout:VerticalLayout binding="{/Logs/0}">
	<Text text="Latest update"/>
	<Text id="LastUpdatedSynchronizeDateStringText" text="{EventDate}"/>
</layout:VerticalLayout>

Answers (0)