I have 3 sets of objects, 1 Set can be map to a corresponding set by a unique key. That same set can be mapped to the 3rd set by a different key. I need to be able to map all of these into a new combined set. These sets all have different properties.
Unique Count [users][sector]
Many Count [invoices]
Each unique [user] belongs to a specific [sector] found by (comitID), that same [user] can have many [invoices] though. A one to many field if your familiar with Relational Databases
const users= [ // Unique Entries
{name:'user1', comitId: 'aa1'},
{name:'user2', comitId: 'aa2'}
]
const sector= [ // Unique Entries
{comitID: 'aa1', department: 'finance'},
{comitID: 'aa2', department: 'marketing'},
{comitID: 'aa3', department: 'engineering'}
]
const invoices= [ // Multiple Entries
{name: 'user1' : statementDate: '2/1/2019'},
{name: 'user1' : statementDate: '2/14/2019'},
{name: 'user2' : statementDate: '2/1/2019'}
]
The new set should look like this. Cannot contain a list for the statement dates, they each need to be a new object.
const results = [
{name: 'user1', comitId: 'aa1', department: 'finance', statementDate: '2/1/2019'},
{name: 'user1', comitId: 'aa1', department: 'finance', statementDate: '2/14/2019'},
{name: 'user2', comitId: 'aa2', department: 'marketing', statementDate: '2/1/2019'}
]
I have been trying this in Excel with vlookups and formulas. These files tend to be 10k for the unique counts and up 40k for the invoices.