4 Replies Latest reply on May 8, 2020 2:46 AM by Vaishali Ahlawat

    HOW TO: Show all 'n' levels of hierarchy of Structure Groups in PIM 8.1.1 Export?

    Anurag Chourasia Guru

      Hi All,

       

      We have a requirement where we need to publish Product data to downstream system in JSON format. In JSON, along with Products general details, we also need to publish all 'n' levels of hierarchy.

      For example:

       

      Consider a scenario where we have defined a Structure System called "Products".

       

      In the Structure System we have 5 levels of Structure Group as shown below:

       

      "Products"

           Structure Group Level 1

                Structure Group Level 2

                     Structure Group Level 3

                          Structure Group Level 4

                               Structure Group Level 5 (Leaf Node)

                                         Product Number "12376982"

           Structure Group Level 1

      .

      .

           Structure Group Level 5

       

      In above example we have a product "12376982" at level 5 which is leaf node. in JSON export we want to send complete hierarchy of the product.

       

      In OOTB PIM export I can see we have a data field which provides information about immediate parent but not complete hierarchy.

       

      Is there any way to show complete hierarchy to achieve this ?

       

      Regards

      Anurag Chourasia

        • 1. Re: HOW TO: Show all 'n' levels of hierarchy of Structure Groups in PIM 8.1.1 Export?
          Lokesh Kumar Guru

          Hi Anurag,

           

          Structure groups are interlinked due to proxy transition. If you can use the datafield to get leaf node in the exort template, then you can traverse to its parent subsequently to its parent and so on.

           

          Example:

           

          {&Product.Structure group(s) (<StructureSystem>).Parent Group.Parent Group.Parent Group.Name (English)}

           

          But in case you are doing this on every export/article, I would say to export whole structure system to downstream once to keep that as a reference rather everytime you fetch whole hierarchy each time. So that next time you know leaf node already system knows the whole hierarchy.

           

          - Lokesh

          1 of 1 people found this helpful
          • 2. Re: HOW TO: Show all 'n' levels of hierarchy of Structure Groups in PIM 8.1.1 Export?
            Anurag Chourasia Guru

            Hi Lokesh,

             

            Thanks for your input. Can you please let me now how to extract entire structure hierarchy from PIM?

             

            We want to generate JSON in below format:

             

            Data

            {

            "Structure Level 1":"Computers",

            "Structure Level 2":"Laptop",

            "Structure Level 3":"Screen",

            "Structure Level 4":"LCD"

            }

             

            Regards

            Anurag Chourasia

            • 3. Re: HOW TO: Show all 'n' levels of hierarchy of Structure Groups in PIM 8.1.1 Export?
              Dave Nacy Guru

              I would do a compare on the current Structure Group level so you can output the correct number of parents (e.g. {&Structure group.Parent Group.Parent Group.Parent Group.Structure group identifier} for level 4).

               

              You can do a compare for each level down to the deepest in your Structure System and get out all the parent references for each level.

              • 4. Re: HOW TO: Show all 'n' levels of hierarchy of Structure Groups in PIM 8.1.1 Export?
                Vaishali Ahlawat Guru

                Hi Dave,

                 

                I am very new to PIM and got this requirement for exporting one particular structure in JSON format .

                I can export this and can get result something like:

                L1:X

                L2:Y

                L3:Z

                 

                but with this the problem I am facing is that when L2 changes to another L2 under  same L1 it gives me an empty curly braces .

                Along with this I got a refinement in the requirement in which the export they want should look like this:

                (L1)

                    (L2)

                          (L3)

                           (L3)

                (L1)

                    (L2)

                    (L3)

                 

                Means if L2 has a 3rd level then all 3rd levels should come together along with L1 and L2 .

                 

                Another problem I have is if I put my JSON as a result of compare funtion ,it gives me data with slashes, something like :

                 

                \"Level1 Code\": \"A\" .

                 

                I tried like:

                ""L1 Cd": "{&Structure group.L1Cd}","L1Desc" : "{&Structure group.L1Desc}",

                "L2 Cd": "{&Structure group.L2Cd}","L2 Desc" : "{&Structure group.L2 Desc}",

                "L3 Cd": "{&Structure group.L3Cd}","L3Cd" : "{&Structure group.L3Desc}"",

                {?CompareIgnoreCase {?ValueGet "type"},"level2",

                ""L1 Cd": "{&Structure group.L1Cd}","L1Desc" : "{&Structure group.L1Desc}",

                "L2 Cd": "{&Structure group.L2Cd}","L2 Desc" : "{&Structure group.L2 Desc}"",""}}

                 

                I am not sure where I am going wrong, can someone suggest me feasible way of achieving it please?

                 

                Really appreciate the help in advance .

                 

                Thanks,

                Vaishali