cancel
Showing results for 
Search instead for 
Did you mean: 

odata V4 xml binding with nested expands and filters in sapui5 xml view for a table

former_member374496
Participant
0 Kudos
1,553

Dear ui5 expertise ,

I have requirement to bind the blow url to table in odata V4 version, I just started working on oData V4 .

I need to bind the nested expands with filters and select as well in the relatives entity with filters .

Request :

http://localhost:8080/api/WorkflowService/Workflow(3ef86f62-3ef2-44cf-84b3-26f843c4672a)/travelAllow...

response :

// 20201224142743
{
  "@context": "$metadata#TravelAllowance(UUID,travelAllowanceForIndividual(UUID,staffRight,staffBenefit,comments,relatives(UUID,type,name,age,dateOfBirth)))",
  "@metadataEtag": "W/\"7db720ecd9d7aa483fbc59f5c86caf2a3736dbe2a2335fe2098874c8dd4ae3b3\"",
  "value": [
    {
      "UUID": "b1d0aec5-8e41-4126-9f50-89eeb3d65cdd",
      "travelAllowanceForIndividual": [
        {
          "UUID": "41b1cb81-e97c-495d-ac83-ee031c91b5be",
          "staffRight": false,
          "staffBenefit": false,
          "comments": "commented",
          "relatives": null
        },
        {
          "UUID": "91f60427-0f9c-4799-8030-4d27d7b9b874",
          "staffRight": false,
          "staffBenefit": false,
          "comments": "commented",
          "relatives": {
            "UUID": "366773ca-e01e-4ae5-8806-70d30ce4eede",
            "type": "child",
            "name": "Lee",
            "age": "10",
            "dateOfBirth": "2000-10-11"
          }
        }
      ]
    }
  ]
}

I need to display : relatives entity data

in the xml view I was trying something, like this but this : but i am not able to apply filter to this:

<VBox items="{ path: 'WorkflowModel>travelAllowance' , startIndex : 0, length : 1,
    filters : [ { path : 'relatives/type', operator : 'EQ', value1 : 'child'} ]  }">
        <Table inset="false"
            items="{path : 'WorkflowModel>travelAllowanceForIndividual', 
            parameters:{
            $expand:{
                        'relatives':{
                            $select : ['name,dateOfBirth,type']
                                    }
                            }
                        }
        
                    }">
            <columns>
                <Column>
                    <Text text="{i18n>label.travelExpense.common.name}"/>
                </Column>
                <Column>
                    <Text text="{i18n>label.travelExpense.common.dob}"/>
                </Column>
                <Column >
                    <Text text="{i18n>label.travelExpense.common.age}"/>
                </Column>
                <Column >
                    <Text text="{i18n>label.staffMember.right}"/>
                </Column>
                <Column>
                    <Text text="{i18n>label.staffMember.benefit}"/>
                </Column>
                <Column>
                    <Text text="{i18n>label.staffMember.comments}"/>
                </Column>
            </columns>
            <items>
                <ColumnListItem>
                    <cells>
                        <Text text="{WorkflowModel>relatives/name}" wrapping="false"/>
                        <Text text="{WorkflowModel>relatives/dateOfBirth}" wrapping="false"/>
                        <Text text="{WorkflowModel>relatives/age}" wrapping="false"/>
                        <Switch state="{WorkflowModel>staffRight}">
                            <layoutData>
                                <FlexItemData growFactor="1"/>
                            </layoutData>
                        </Switch>
                        <Switch state="{WorkflowModel>staffBenefit}">
                            <layoutData>
                                <FlexItemData growFactor="1"/>
                            </layoutData>
                        </Switch>
                        <Text text="{WorkflowModel>comments}" wrapping="false"/>
                    </cells>
                </ColumnListItem>
            </items>
        </Table>
    </VBox>




Please help:

thanks in advance,

Pradeep

Accepted Solutions (0)

Answers (0)