Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
aveeeeeee7en
Valued Contributor 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

Tags (1)
5 Replies
Not applicable

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

aveeeeeee7en
Valued Contributor III

Re: IF Condition Logic

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

Re: IF Condition Logic

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

aveeeeeee7en
Valued Contributor III

Re: IF Condition Logic

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;

bruno_montenegr
Contributor III

Re: IF Condition Logic

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.

Community Browser