Skip to Content

XML Embedded Binding expression with filtered element

Hello experts,

I'm trying to apply an expression binding in my XML view for a property and I want to filter a set of elements and check a specific element value. The SAPUI5 documentation give us the example below:

{:= ${path:'target>extensions/[${name} === \'semantics\']/value'} === 'email'}

https://sapui5.hana.ondemand.com/1.34.9/docs/guide/daf6852a04b44d118963968a1239d2c0.html

But I was unable to replicate.... The control never is displayed.

Here is my JSON (from JSONModel):

{ "results": [ { "App": "DEMO", "Read": true }, { "App": "DEMO2", "Read": false } ] }

In onInit method I do the setModel (UserAuthorization) in the view, and in my view.xml:

<m:Text id="testField" text="test" visible="{= ${path:'UserAuthorization>/results/[${App} === \'DEMO\']/Read'} === true}"/>

I'm able to send the JSONModel to a formatter function, however, I'd like to evaluate directly on XML Binding...

Obs: I've already defined data-sap-ui-xx-bindingSyntax="complex" in my index.html

Any idea how this can be done??

Thanks

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Oct 29, 2019 at 04:29 PM

    I haven't done that before,

    but I think it is expecting the data like this, so it is not for your case.

    <Property Name="CURRENCY" Type="Edm.String" MaxLength="5" sap:display-format="UpperCase" sap:label="Currency" sap:sortable="false" sap:value-list="standard" sap:semantics="currency-code"/>

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.