I have two hash tables created from data from two different XML files. What I would like to do is combine the two tables into a single hash table based on a common value in the both tables.
Inv Hash:
$invHash = $invXML.InventoryDto.ProductInventoryItem.SkuInventoryItem |
select @{ L = 'SkuID'; E = { $_.SkuId } }, @{ L = 'SkuStatusCode';
E = { if ($_.SkuStatusCode -eq 'Active') { 'True' } else { 'False'} } },
@{ L = 'QuantityOnHand'; E = { $_.QuantityOnHand } }
Sample Contents of $invHash:
SkuID SkuStatusCode QuantityOnHand
----- ------------- --------------
1828 True 441
3022 True 325
2981 True 214
2989 True 842
PriceHash:
$priceHash = $priceXML.PricingDto.ProductPricingItem.SkuPricingItem |
select @{ L = 'SkuID'; E = { $_.SkuId } }, @{ L = 'RegularPrice';
E = { $_.PriceGroup.RegularPrice } }, @{ L = 'CurrentPrice';
E = { $_.PriceGroup.CurrentPrice } }
Sample contents of $priceHash:
SkuID RegularPrice CurrentPrice
----- ------------- --------------
1828 49.99 48.99
3022 25 19.99
2981 45 39.99
2989 28 18.99
Desired contents of $invpriceHash:
SkuID SkuStatusCode QuantityOnHand RegularPrice CurrentPrice
----- ------------- -------------- -------------- --------------
1828 True 441 49.99 48.99
3022 True 325 25 19.99
2981 True 214 45 39.99
2989 True 842 28 18.99