Bear with me as this is a problem that I am struggling with so I might not explain it very well!
I have an array of values and two strings: e.g.
["5", "6"]
"DEPOT_NAME",
"DEPOT_ID"
I also have an array of objects (only one in this example but can be multiple):
[
{
columns: [
{name: "DEPOT_ID"},
{name: "DEPOT_NAME"},
{name; "REGION_ID"},
{name: "CREATED_DATE"},
{name: "MODIFIED_DATE"}
],
id: 1,
rows: [
{data: {DEPOT_ID: "0", DEPOT_NAME: "London", REGION_ID: "0", CREATED_DATE: "2016-05-03", MODIFIED_DATE: "2016-05-03"}},
{data: {DEPOT_ID: "1", DEPOT_NAME: "Abbey Road", REGION_ID: "1", CREATED_DATE: "2016-05-03", MODIFIED_DATE: "2016-05-03"}},
{data: {DEPOT_ID: "3", DEPOT_NAME: "Romford", REGION_ID: "3", CREATED_DATE: "2016-05-03", MODIFIED_DATE: "2016-05-03"}},
{data: {DEPOT_ID: "5", DEPOT_NAME: "Bristol", REGION_ID: "5", CREATED_DATE: "2016-05-03", MODIFIED_DATE: "2016-05-03"}},
{data: {DEPOT_ID: "6", DEPOT_NAME: "Croydon", REGION_ID: "6", CREATED_DATE: "2016-05-03", MODIFIED_DATE: "2016-05-03"}}
],
title: "Depots"
}
]
Using the values that I have I need to get the value for the DEPOT_NAME key that corresponds to the correct DEPOT_ID value. The array above can be used to find the correct depot ids I assume but then how would I go about get the value for the depot name?
I hope I explained that ok, if you need more clarification I will try my best to make it clearer.
Any help with this would be much appreciated.
Thanks for your time.