5 Replies Latest reply: Jun 16, 2014 4:46 PM by Bruno Souza RSS

    IF Condition Logic

    AVIRAL NAG

      Hi Community

       

      Employee
        No
      NameReports ToRequired Result
      1111AAAAAADDDDDDD2000
      1112BBBBBBBDDDDDDD2000
      1113CCCCCCDDDDDDD2000

       

      I am making Hierarchy. I have Employee No, Name and Reports To. The Reports To is causing problem in creating the Hierarchy since it is not having Employee Code, it has Employee Name.

      So, what i want where ever "Reports To" Employee Name is coming there i Want to Show "Reports To" Employee ID from the Script.

      The Desired Output,I have shown in above chart.

       

       

      Regards

      Aviral

        • Re: IF Condition Logic

          Are you trying to make a table that shows all this information?  and you're asking how to write a statement to show the ID of who the employee reports to?

           

          Try just using set analysis.  The condition would be the name of the person reported to

            • Re: IF Condition Logic
              AVIRAL NAG

              Hi Robert

              Thanks for the reply. But I don't want to use Set Analysis as i said that i want Reports To Employee ID from script using if condition. Is there a workaround.

               

              Hierarchy:

               

               

              Hierarchy ([Employee No], [Reports To], [Name], [Manager Name], [Name], Hierarchy, '/')
              LOAD
              [Employee No],
              [Reports To],  // This is causing problem since it's a name and i want Employee Code instead of Name
              [Employee Name] as Name
              RESIDENT Employee;

               

            • Re: IF Condition Logic
              Bruno Souza

              Hi, Neg.

               

              Try this:

               

              MAP_Name2Code:

              Mapping LOAD

              [Employee Name],

              [Employee No]
              RESIDENT Employee;

               

              Hierarchy ([Employee No], [Reports To], [Name], [Manager Name], [Name], Hierarchy, '/')
              LOAD
              [Employee No],
              ApplyMap('MAP_Name2Code', [Reports To]) as [Reports To],
              [Employee Name] as Name
              RESIDENT Employee;

               

              First we create a map name to code and then apply that map to get the code instead of the name in the Hierarchy. Hope is helps.

               

              Regards.