Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
aveeeeeee7en
Specialist III
Specialist III

IF Condition Logic

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

5 Replies
Not applicable

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

aveeeeeee7en
Specialist III
Specialist III
Author

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;

Not applicable

How is your data set up that you're importing?  Would it be possible to use a join?

aveeeeeee7en
Specialist III
Specialist III
Author

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;

Anonymous
Not applicable

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.