Search code examples
javascriptxmlsapui5

how to use valuestate in xml view>


I have valueState atrribute in my input element:

valueState="{= ${myModel>/myProperty} > 0 ?'None':'Error' }"

this seem to work. But I want to modify my property first, before comparison to 0 like this:

valueState="{= $ parseFloat({myModel>/myProperty}.replace(',','.')) > 0 ?'None':'Error' }"

basically i want to modify string and convert myProperty to number before comparing with 0 to set value state

Any help would be appreciated.


Solution

  • You are really close, the correct syntax would be the following.

    valueState="{= parseFloat(${myModel>/myProperty}.replace(',','.')) > 0 ?'None':'Error' }"
    

    The dollar sign is the sign for the expression binding to read from a model.