Skip to Content
0
Dec 29, 2016 at 02:34 PM

Save property from OData list into variable

58 Views

I am trying to get a property from an OData list saved into a variable in javascript.

The model looks like this:

Eg. if I want to store the property Werks from list "0001", I can do it like this:

oModel.getProperty("/ZcountWerksSet('0001')/Werks")

The problem is, this is a dynamic list. I don't know what the values in the parentheses are, but I know the order of the list. Should it not be possible to do something like this then:

oModel.getProperty("/ZcountWerksSet/0/Werks")

This is not working, it returns "undefined".

How can I store the property "Werks" from the first element in the "ZcountWerks" list into a variable in JavaScript?

Attachments

odata-kopi.jpg (40.6 kB)