Is it possible to remove a property after the first run in the foreach loop, i want to remove the property "pickedQuantity".
Asked
Active
Viewed 1,255 times
2 Answers
0
To remove properties from an object you can use
removeProperty function https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#removeProperty
But not sure how this is possible in your loop. If you always want to remove it after the first run, why not do the first "run" outside the loop, then loop the rest?

viktorh
- 152
- 13
0
One of the workaround is to add the property outside the foreach loop in order to have it only once. For instance here is the sample json I have taken
{
"shipmentLines":
[
{
"PART_NO":1,
"WEB_ORDER_LINE_NUMBER":20,
"WEB_ORDER_NUMBER":30
},
{
"PART_NO":2,
"WEB_ORDER_LINE_NUMBER":298,
"WEB_ORDER_NUMBER":347
}
]
}
This is my Logic app where I'm storing the Compose
content to an array variable and removing the pickedQuantity property and added after the foreach loop:-
Here is the Json code in my Compose 2
Connector.
{
"shipmentLines": [
{
"pickedQuantity": "1",
"shipmentDetails": @{variables('SampleArray')}
}
]
}
Here is the output:-
The Final Compose output:-
{
"shipmentLines": [
{
"pickedQuantity": "1",
"shipmentDetails": [
{
"shipmentLines": [
{
"articleNo": "2",
"customerOderNo": "347",
"lineNumber": "298"
}
]
},
{
"shipmentLines": [
{
"articleNo": "1",
"customerOderNo": "30",
"lineNumber": "20"
}
]
}
]
}
]
}

SwethaKandikonda
- 7,513
- 2
- 4
- 18