cancel
Showing results for 
Search instead for 
Did you mean: 

Issue joining serveral datasets together

Max
New Contributor II

Hello,

Im trying to join several datasets together and wrap that in a object called

overallMetrics. Im running into an issue when I add a mapper after the union snap. Its adding overallMetrics to each object .

I have attached screen shots of the pipeline and mapper snap. Below is the input and the expected output. Thank you for your help.

Input:

 
[
{
"riskDetails":{
"riskScore":{
"overallRisk":"87.33"
"lowRiskCount":3
"mediumRiskCount":0
"highRiskCount":0
"statesByLowRisk":["Minnesota"]
"statesByMediumRisk":[]
"statesByHighRisk":[]
"countriesByLowRisk":["SWEDEN","UNITED STATES"]
"countriesByMediumRisk":[]
"countriesByHighRisk":[]
}
"mitigationStrategies":{
"lowRiskMitigationCodes":["Increased Inventory","Implementing a contract"]
"mediumRiskMitigationCodes":[]
"highRiskMitigationCodes":[]
}
}
},
{
"diversityMetrics":[
{
"diversityClassificationCode":"HUBZone Small Businesses",
"percentOfTotalSpend":0.1,
"percentOfTotalSuppliers":0.2
},
{
"diversityClassificationCode":"Minority Owned",
"percentOfTotalSpend":0.6,
"percentOfTotalSuppliers":1.4
},
{
"diversityClassificationCode":"Service Disabled Veteran Owned Small Businesses",
"percentOfTotalSpend":0.0,
"percentOfTotalSuppliers":0.1
},
{
"diversityClassificationCode":"Small Businesses",
"percentOfTotalSpend":9.8,
"percentOfTotalSuppliers":26.1
},
{
"diversityClassificationCode":"Small Disadvantaged Businesses",
"percentOfTotalSpend":0.4,
"percentOfTotalSuppliers":1.9
},
{
"diversityClassificationCode":"Veteran Owned",
"percentOfTotalSpend":0.0,
"percentOfTotalSuppliers":0.1
},
{
"diversityClassificationCode":"Veteran Owned Small Businesses",
"percentOfTotalSpend":0.3,
"percentOfTotalSuppliers":1.2
},
{
"diversityClassificationCode":"Woman Owned",
"percentOfTotalSpend":0.3,
"percentOfTotalSuppliers":1.5
},
{
"diversityClassificationCode":"Woman Owned Small Businesses",
"percentOfTotalSpend":0.6,
"percentOfTotalSuppliers":2.7
}
]
},
{
"rawMaterialSource":{
"insideUsaPercentage":72
"statesInsideUsa":[
"Arizona","Connecticut","Florida","Georgia","Illinois","Indiana","Massachusetts","Michigan","Minnesota","New Hampshire"
]
"outsideUsaPercentage":28
"countriesOutsideUsa":[
"AUSTRALIA","CANADA","DENMARK","GERMANY","IRELAND","JAPAN","SWITZERLAND"
]
}
}
]
 
Expected output:
 
{
overallMetrics:
{
"riskDetails":{
"riskScore":{
"overallRisk":"87.33"
"lowRiskCount":3
"mediumRiskCount":0
"highRiskCount":0
"statesByLowRisk":["Minnesota"]
"statesByMediumRisk":[]
"statesByHighRisk":[]
"countriesByLowRisk":["SWEDEN","UNITED STATES"]
"countriesByMediumRisk":[]
"countriesByHighRisk":[]
}
"mitigationStrategies":{
"lowRiskMitigationCodes":["Increased Inventory","Implementing a contract"]
"mediumRiskMitigationCodes":[]
"highRiskMitigationCodes":[]
}
}
},
{
"diversityMetrics":[
{
"diversityClassificationCode":"HUBZone Small Businesses",
"percentOfTotalSpend":0.1,
"percentOfTotalSuppliers":0.2
},
{
"diversityClassificationCode":"Minority Owned",
"percentOfTotalSpend":0.6,
"percentOfTotalSuppliers":1.4
},
{
"diversityClassificationCode":"Service Disabled Veteran Owned Small Businesses",
"percentOfTotalSpend":0.0,
"percentOfTotalSuppliers":0.1
},
{
"diversityClassificationCode":"Small Businesses",
"percentOfTotalSpend":9.8,
"percentOfTotalSuppliers":26.1
},
{
"diversityClassificationCode":"Small Disadvantaged Businesses",
"percentOfTotalSpend":0.4,
"percentOfTotalSuppliers":1.9
},
{
"diversityClassificationCode":"Veteran Owned",
"percentOfTotalSpend":0.0,
"percentOfTotalSuppliers":0.1
},
{
"diversityClassificationCode":"Veteran Owned Small Businesses",
"percentOfTotalSpend":0.3,
"percentOfTotalSuppliers":1.2
},
{
"diversityClassificationCode":"Woman Owned",
"percentOfTotalSpend":0.3,
"percentOfTotalSuppliers":1.5
},
{
"diversityClassificationCode":"Woman Owned Small Businesses",
"percentOfTotalSpend":0.6,
"percentOfTotalSuppliers":2.7
}
]
},
{
"rawMaterialSource":{
"insideUsaPercentage":72
"statesInsideUsa":[
"Arizona","Connecticut","Florida","Georgia","Illinois","Indiana","Massachusetts","Michigan","Minnesota","New Hampshire"
]
"outsideUsaPercentage":28
"countriesOutsideUsa":[
"AUSTRALIA","CANADA","DENMARK","GERMANY","IRELAND","JAPAN","SWITZERLAND"
]
}
}
}

 

 

1 ACCEPTED SOLUTION

AleksandarAngel
Contributor III

Hello @Max,

You can try by using Join Snap instead, with Join Type set to Merge.

AleksandarAngel_0-1708073610739.png

After this just use a Mapper Snap with the following Mapping Table:

AleksandarAngel_1-1708073669379.png

Attached below is the sample pipeline.

View solution in original post

1 REPLY 1

AleksandarAngel
Contributor III

Hello @Max,

You can try by using Join Snap instead, with Join Type set to Merge.

AleksandarAngel_0-1708073610739.png

After this just use a Mapper Snap with the following Mapping Table:

AleksandarAngel_1-1708073669379.png

Attached below is the sample pipeline.