Reporting Hierarchy

 4 Replies
 0 Subscribed to this topic
 68 Subscribed to this forum
Sort:
Author
Messages
mil0n023
Veteran Member
Posts: 63
Veteran Member
    In Crystal is it possibel to develop a reporting hierarchy for the organization (i.e. dept's flowing up through managers, directors, etc.)?

    If so, where can I get this data?
    M. C. Miller
    Analyst
    Salem, Oregon
    John Henley
    Posts: 3353
      Assuming you've built out your supervisor structure in Lawson, this data can be retrieved from the HRSUPER table. The issues are 1) how many levels to go, 2) what to do about people who report to themselves or no one, 3) Lawson doesn't handle indirect supervisor/dotted lines, etc. To do it quickly, you could just left outer join xx number of levels, where xx is a reasonable number, like 5 or 8 or 10, etc. To do it really correctly, you'd want to created a stored procedure that recursively walks up the hierarchy until all levels are exhausted.
      Thanks for using the LawsonGuru.com forums!
      John
      Travis Cox
      Basic Member
      Posts: 4
      Basic Member
        if you are using oracle for your db you can take advantage of the hierarchical query feature by adding the following as a crystal sql expression

        select name-or-whatever
        from employee
        start with supervisor is null
        connect by prior employee = supervisor;
        John Henley
        Posts: 3353
          MSSQL 2005 has this feature now as well--search for "recursive queries". If you're using MSSQL 2000, you can simulate it by writing a procedure--search OnLine Library for "expanding hierarchies".
          Thanks for using the LawsonGuru.com forums!
          John
          jbullman
          New Member
          Posts: 1
          New Member
            For several recent versions of Crystal you can also set up a hierarchy directly in the report design. Link the EMPLOYEE table to HRSUPER to another copy of EMPLOYEE. That last link should be a left outer join. Group on the employee's ID ({EMPLOYEE.EMPLOYEE}), and then choose Report/Hierarchical Grouping. Enter the parent of the employee ID from the second copy of the EMPLOYEE table.

            I can spell this out more carefully if anyone needs.