cancel
Showing results for 
Search instead for 
Did you mean: 

Reading deferred calls in sapui5 for a single get call

aditya_pratap
Explorer
0 Kudos

Hi Experts,
I have a scenario where i have just one GET call.
It has other child entities with association to parent entity.
When I am trying to bind, I am getting the data from parent entity,but not able to read child entity as they are under deferred tag in odata response.
How can i read the

child related data?

View Entire Topic
leonikussmaul
Product and Topic Expert
Product and Topic Expert

Hi Aditya,

You can add the expand command to your binding like below;

i.e. For a Table binding, simply add it to the items aggregation in your XML view.

<Table
    items="{
        path: '/yourEntity',
        parameters : {
        expand : 'Process'
        }
    }" >

If you are bindign the view in your controller, you can try adding the parameter like this.

this.getView().bindElement({
path: "/yourEntity"
parameters: {
expand: "Process"
}
});
aditya_pratap
Explorer
0 Kudos

Hi Leoni,

Thanks for the inputs.
I tried the approach suggested by you.
But, I am not able to see any data for child set(in this case- Process).
Since, it is deferred, do I need to do something else?

Regards,

Aditya

leonikussmaul
Product and Topic Expert
Product and Topic Expert
0 Kudos

what is the name of the navigation property? You will need this..

aditya_pratap
Explorer
0 Kudos

Hi Leoni,
I tried with the highlighted navigation names.Still, it does not work.

Here Track is my parent and the below 3 are child entities.

Regards,

Aditya

Marian_Zeis
Active Contributor

Can you show how your binding or code looks like?

You can use it in the XML View

<Table id="trackTable" items="{ path: '/Track', parameters: { expand: 'Process' } }">
    <!-- Sample columns for main entity -->
    <columns>
        <Column><Text text="Process ID" /></Column>
        <Column><Text text="Object ID" /></Column>
        <Column><Text text="Changed On" /></Column>
        <Column><Text text="Description from Process" /></Column>
    </columns>
    <items>
        <ColumnListItem>
            <cells>
                <Text text="{ProcessId}" />
                <Text text="{Objectid}" />
                <Text text="{Datetimelin}" />
                <Text text="{Process/Description}" /> <!-- Assuming 'Description' exists in 'Process' entity -->
            </cells>
        </ColumnListItem>
    </items>
</Table>

or in the Controller

oModel.read("/Track", {
    urlParameters: {
        "$expand": "Process"
    },
    success: function(oData, oResponse) {
        // Data successfully fetched
        console.log(oData);
        // oData.results will have the fetched data
    },
    error: function(oError) {
        // Error handling
        console.error("Data fetch failed:", oError);
    }
});