1 Reply Latest reply: Sep 19, 2017 7:45 AM by hari krishna RSS

    Hierarchy

    Vítor Castro

      Hello everyone,

       

      i am trying to develop an hierarchy of a organization structure.

       

      Untitled.png

       

      I am having a problem. I want the appearance of left board and i am obtaining the structure of the rigth board.

       

      My dataset is:

       

      NAMEPROLEREPORTINGMANAGERLEVELOFBUSINESSHEAD
      AnnDirectorCEOCompany
      JohnCEOCompany

       

      The code, i found here:

       

       

      TREE_VIEW:

      LOAD Distinct NAMEP as VALUE, NAMEP & '-NAME' as NODE_ID, ROLE & '-ROLE' as PARENT_NODE_ID, PICTUREID as Item resident Data;

      LOAD Distinct ROLE as VALUE, ROLE & '-ROLE' as NODE_ID, REPORTINGMANAGER & '-REPORTINGMANAGER' as PARENT_NODE_ID, ' ' as Item resident Data;

      LOAD Distinct REPORTINGMANAGER as VALUE, REPORTINGMANAGER & '-REPORTINGMANAGER' as NODE_ID,  LEVELOFBUSINESSHEAD & '-LEVELOFBUSINESSHEAD' as PARENT_NODE_ID, ' ' as Item resident Data;

      LOAD Distinct LEVELOFBUSINESSHEAD as VALUE,LEVELOFBUSINESSHEAD & '-LEVELOFBUSINESSHEAD' as NODE_ID,  LEVELOFBUSINESSHEAD & '-LEVELOFBUSINESSHEAD' as PARENT_NODE_ID, ' ' as Item resident Data;

       

      HIERARCHY_TABLE:

      Hierarchy(NODE_ID_H,PARENT_NODE_ID_H, ID, PARENT_NAME, NAME, Organization_Structure) load

      NODE_ID,

      NODE_ID as NODE_ID_H,

      PARENT_NODE_ID as PARENT_NODE_ID_H,

      VALUE as ID,

      VALUE as NAME

      resident TREE_VIEW;

       

       

      Can someone help me finding my mistake?

       

      Greetings

        • Re: Hierarchy
          hari krishna

          Use below script or else find the attached qvw.

           

           

           

          Data:

          CrossTable(Levels,Data,2)

          LOAD employeeid, positiontype, level0, level1, level2, level3, level4, level5

          FROM [C:\Users\E5544270\Downloads\hierarchy.xlsx] (ooxml, embedded labels, table is Sheet1);

           

           

           

           

          Hierarcy:

          LOAD Levels&'_levels' as value,Levels&'_levels' as nodeid,Levels&'_levels' as parentid Resident Data;

          LOAD positiontype&'_positiontype' as value,positiontype&'_positiontype' as nodeid,Levels&'_levels' as parentid Resident Data;

          LOAD employeeid&'_employeeid' as value,employeeid&'_employeeid' as nodeid,positiontype&'_positiontype' as parentid Resident Data;

           

           

           

           

          final:

          Hierarchy(nodeid,Newparentid,id,parentidnew,name,structure)

          LOAD

          value as id,

          value as name,

          nodeid,

          nodeid as newnodeid,

          parentid as Newparentid

           

           

          Resident Hierarcy;

          DROP Table Hierarcy;

          DROP Table Data;