I have a datasource data which is an array of object and it has Column. How do we match it to the tempValues object and get the tempValues values that matches the column on dataSource.
The finalOuput is provided below on how the final ouput should look like . Thanks.
#Data Source
dataSouce = [
{
"name": "NVB",
"value": 0,
"financeValue": 0,
"column": "nvb",
"isEdit": false
},
{
"name": "ROU",
"value": 0,
"financeValue": 0,
"column": "rou",
"isEdit": false
},
{
"name": "Net Present Value",
"value": 0,
"financeValue": 0,
"column": "netPresentValue",
"isEdit": false
},
]
#tempValues
tempValues = {
"transactionId": 20,
"nvb": 20,
"rou": 100,
"netPresentValue": 50,
}
#FinalOutput
= [
{
"name": "NVB",
"value": 20,
"financeValue": 0,
"column": "nvb",
"isEdit": false
},
{
"name": "ROU",
"value": 100,
"financeValue": 0,
"column": "rou",
"isEdit": false
},
{
"name": "Net Present Value",
"value": 50,
"financeValue": 0,
"column": "netPresentValue",
"isEdit": false
},
]