suppressing duplicates in repetitive elements in xml using

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
thupallireddy
Participant
Posts: 16
Joined: Wed Apr 30, 2014 1:27 am
Location: Benagaluru

suppressing duplicates in repetitive elements in xml using

Post by thupallireddy »

o/p is

Code: Select all

</Product>
        <Product>
            <ExternalId>product123</ExternalId>
            <Name>Gola Active Women's Verde 2 Trainers</Name>
            <Description>The Verde 2 trainers from Gola </Description>
            <BrandExternalId>Gola</BrandExternalId>
            <CategoryExternalId>catg1</CategoryExternalId>
            <ProductPageUrls>
                <ProductPageUrl locale="en_IE">http://exam.com/product/Gola%20Active%20Women's%20Verde%202%20Trainers/product123</ProductPageUrl>
                <ProductPageUrl locale="en_IE">http://exam.com/product/Gola%20Active%20Women's%20Verde%202%20Trainers/product123</ProductPageUrl>
                <ProductPageUrl locale="pl_PL">http://exam.com/product/Gola%20Active%20Women's%20Verde%202%20Trainers/product123</ProductPageUrl>
                <ProductPageUrl locale="pl_PL">http://exam.com/product/Gola%20Active%20Women's%20Verde%202%20Trainers/product123</ProductPageUrl>
            </ProductPageUrls>
            <ImageUrls>
                <ImageUrl locale="en_IE">http://i1.adis.ws/s/sam/product123_is.jpg?$zoom_main_v2$</ImageUrl>
                <ImageUrl locale="en_IE">http://i1.adis.ws/s/sam/product123_is.jpg?$zoom_main_v2$</ImageUrl>
                <ImageUrl locale="pl_PL">http://i1.adis.ws/s/sam/product123_is.jpg?$zoom_main_v2$</ImageUrl>
                <ImageUrl locale="pl_PL">http://i1.adis.ws/s/sam/product123_is.jpg?$zoom_main_v2$</ImageUrl>
            </ImageUrls>
            <UPCs>
                <UPC>5053087257244</UPC>
                <UPC>5053087257268</UPC>
                <UPC>5053087257244</UPC>
                <UPC>5053087257268</UPC>
            </UPCs>
            <Names>
                <Name locale="en_IE">Gola Active Women's Verde 2 Trainers</Name>
                <Name locale="en_IE">Gola Active Women's Verde 2 Trainers</Name>
                <Name locale="pl_PL">Gola Active Women's Verde 2 Trainers</Name>
                <Name locale="pl_PL">Gola Active Women's Verde 2 Trainers</Name>
            </Names>
</Product>
i/p is

Code: Select all

product_id			Name								DESC						 catg	locale	 upc
product123	| Gola Active Women's Verde 2 Trainers | The Verde 2 trainers from Gola | catg1| en_IE |3015087257244 
product123	| Gola Active Women's Verde 2 Trainers | The Verde 2 trainers from Gola | catg1| en_IE |4290087257268 
product123	| Gola Active Women's Verde 2 Trainers | The Verde 2 trainers from Gola | catg1| pl_PL |3015087257244 
product123	| Gola Active Women's Verde 2 Trainers | The Verde 2 trainers from Gola | catg1| pl_PL |4290087257268 
o/p expected is

Code: Select all

</Product>
        <Product>
            <ExternalId>product123</ExternalId>
            <Name>Gola Active Women's Verde 2 Trainers</Name>
            <Description>The Verde 2 trainers from Gola </Description>
            <BrandExternalId>Gola</BrandExternalId>
            <CategoryExternalId>catg1</CategoryExternalId>
            <ProductPageUrls>
                <ProductPageUrl locale="en_IE">http://exam.com/product/Gola%20Active%20Women's%20Verde%202%20Trainers/product123</ProductPageUrl>
                <<ProductPageUrl locale="pl_PL">http://exam.com/product/Gola%20Active%20Women's%20Verde%202%20Trainers/product123</ProductPageUrl>
            </ProductPageUrls>
            <ImageUrls>
                <ImageUrl locale="en_IE">http://i1.adis.ws/s/sam/product123_is.jpg?$zoom_main_v2$</ImageUrl>
                <ImageUrl locale="pl_PL">http://i1.adis.ws/s/sam/product123_is.jpg?$zoom_main_v2$</ImageUrl>
            </ImageUrls>
            <UPCs>
                <UPC>5053087257244</UPC>
                <UPC>5053087257268</UPC>
            </UPCs>
            <Names>
                <Name locale="en_IE">Gola Active Women's Verde 2 Trainers</Name>
                <Name locale="pl_PL">Gola Active Women's Verde 2 Trainers</Name>
            </Names>
</Product>
Please let me know how we can achieve this.

Currently im using 8.5 xml assembly editor using regroup step in which parent keys are product_id, desc, name...) and child key(upc, locale).

Suggest me how to proceed further.

Thanks in advance.
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Aim to have multiple input links....one with all your page urls....another with your images.....another with your upc's, etc....then regroup each on its common key and then use hjoins to bring them together.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Post Reply