I possess two separate collections of information:
Data Model: taxControlReference
[
{
"providerId": "HE",
"taxTables": {
"STAT": [
1
]
}
},
{
"providerId": "REMC",
"taxTables": {
"STAT": [
1
]
}
},
{
"providerId": "WBLUE",
"taxTables": {
"STAT": [
1
]
}
}
]
Data Model: taxControl
[
{
"taxTypeId": "FED",
"taxIndustryDescription": "Federal",
"taxIndustryLabel": "Federal",
"taxControlReferenceCounter": 1,
"transactionOn": null
},
{
"taxTypeId": "FRAN",
"taxIndustryDescription": "Franchise",
"taxIndustryLabel": "Franchise",
"taxControlReferenceCounter": 1,
"transactionOn": null
},
{
"taxTypeId": "STAT",
"taxIndustryDescription": "State",
"taxIndustryLabel": "State",
"taxControlReferenceCounter": 1,
"transactionOn": null
},
{
"taxTypeId": "CNTY",
"taxIndustryDescription": "County",
"taxIndustryLabel": "County",
"taxControlReferenceCounter": 1,
"transactionOn": null
},
{
"taxTypeId": "TOWN",
"taxIndustryDescription": "City",
"taxIndustryLabel": "City",
"taxControlReferenceCounter": 1,
"transactionOn": null
},
{
"taxTypeId": "SCHL",
"taxIndustryDescription": "School",
"taxIndustryLabel": "School",
"taxControlReferenceCounter": 1,
"transactionOn": null
}
]
Within the taxControlReference
, each key within the taxTables
corresponds with a taxTypeId
in the taxControl
model.
To derive an output based on this data, I am aiming for a structure as follows:
Array<{taxTypeId: string, taxIndustryDescription, options: taxTablesKey[]}>
The process involves the utilization of observables:
// taxControl$ and taxControlReference$ serve as the observables returning data from the aforementioned models
observable$ = CombineLatest([taxControl$, taxControlReference$]).pipe(
// At this stage, difficulty arises when attempting to map out just the taxControl$, resulting in the final object in the array being repeated multiple times corresponding to the array's length of objects
)