{ " Date": "12/02/2022 15:01", "Product Code": "5057636582976207", "Description": "12022 3XL 372 Da", "Qty": "1", "Pricing Inc. VAT": "12" }, { " Date": "12/02/2022 15:33", "Product Code": "505763667606927", "Description": "18939 L 090 ", "Qty": "1", "Pricing Inc. VAT": "33" }, { " Date": "12/02/2022 17:07", "Product Code": "5057633566615660", "Description": "18905 ONE ", "Qty": "1", "Pricing Inc. VAT": "10" }, { " Date": "", "Product Code": "", "Description": "", "Qty": "96", "Pricing Inc. VAT": "1883.6" } the problem is price inc vat in last array will always change so cant use Replace() any idea ?
CodePudding user response:
You can use the Below Expression to fetch the specific result
// Use add & length expression add(length(outputs('Compose')),-1) to remove the no of values
take(outputs('Compose'),add(length(outputs('Compose')),-1))
Follow the workaround
Here I am using your JSON payload and processed with it.
{
"result": [
{
" Date": "12/02/2022 15:01",
"Product Code": "5057636582976207",
"Description": "12022 3XL 372 Da",
"Qty": "1",
"Pricing Inc. VAT": "12"
},
{
" Date": "12/02/2022 15:33",
"Product Code": "505763667606927",
"Description": "18939 L 090 ",
"Qty": "1",
"Pricing Inc. VAT": "33"
},
{
" Date": "12/02/2022 17:07",
"Product Code": "5057633566615660",
"Description": "18905 ONE ",
"Qty": "1",
"Pricing Inc. VAT": "10"
},
{
" Date": "",
"Product Code": "",
"Description": "",
"Qty": "96",
"Pricing Inc. VAT": "1883.6"
}
]
}
Results
CodePudding user response:
A simple substring(variables('sample'),0,lastIndexOf(variables('sample'),', {'))
does the trick since you have provided string. If the value provided is of type array of objects then take(variables('sample'),sub(length(variables('sample')),1))
works.