cancel
Showing results for 
Search instead for 
Did you mean: 

update specific data in an oData model

trusadi
Participant
0 Kudos

Hi,

In my program I have my model like below

connection.png

and now I want to update all objects inside this model which has path beginning with "/DeliveryOrderItemSet". Inside this entity set, there is a property called "Status", and I want to update all the "Status" to "Delivered". How can I do that in a proper way?

Thank

Tjarliman

Accepted Solutions (1)

Accepted Solutions (1)

CristianBabei
Contributor
0 Kudos

Hello,

I found this way...

Dunno if it's the best way, but at least it works 😄

var Test={
"Testing('112')" : { Id: "112", Value: "5"},
"Testing('124')" : { Id: "124", Value: "2"},
"Testing('412')" : { Id: "412", Value: "4"},
"Testing('312')" : { Id: "312", Value: "9"}
}

Object.values(Test) 
Returns you an array.
Object.keys(Test)
Returns you the keys
(4) ["Testing('112')", "Testing('124')", "Testing('412')", "Testing('312')"]
Object.keys(Test)[0]

Now that you have an array of each of them, loop them, and check if the string, contains your pattern. Or just do a split("(")[0]
And if it contains your EntitySet, then the position on the loop, will be the same ,as the one in the array list from the Object.values

I know maybe this isn't a proper way, but, what you are trying to archive isn't very "normal"

Hope this helps 🙂

Regards

Answers (1)

Answers (1)

trusadi
Participant
0 Kudos

Thank you Cristian,

I got the idea, I will test it later.

I am sure it will work.

Cheers.