Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
shanky1907
Creator II
Creator II

Order of projects in employee details

Hello All,

I have an employee database in which we are capturing previous organisation details also.

So, while taking the same, i want to order the organisations that an employee has already work upon.

1. Last Company

2.Second last company

3. Third last company

I am using the below code to give it the order:

prev_org_details_temp:

NoConcatenate

LOAD description as Prev_org_desc,

     eid,

     1 as order,

     enddate as Prev_org_end_date,     

     organisation_name as Prev_org_name,

     rid as Prev_org_role_id,

     role as Prev_org_role,

     startdate as Prev_org_Start_date

FROM

[\.....\QVD\prev_org_details.qvd]

(qvd);

prev_org_details_temp2:

NoConcatenate

load eid,

Prev_org_desc ,

Prev_org_end_date as EndDate,

Prev_org_Start_date as StartDate,

Prev_org_role_id,

Prev_org_name as PreviousOrgName,

Prev_org_role as PrevORGRole,

(num(Prev_org_end_date)-num(Prev_org_Start_date))/365 as tenure,

if(eid=peek(eid),peek(order)+1,order) as PrevOrgOrder ;

But the output only gives PrevOrgOrder =1 for the last company employee worked for. For other porevious organisations, this field is null.

Can you please help me finding the bug in the code and let me know if any mistake i am making in the concept.

Thanks in advance.

5 Replies
sunny_talwar

Would you be able to share a sample to test it?

shanky1907
Creator II
Creator II
Author

No i cannot share that. This is the max information i can share

sunny_talwar

okay

ogautier62
Specialist II
Specialist II

Hi,

I think it's this you want to do :     if(eid=peek('eid'),peek('PrevOrgOrder')+1,order) as PrevOrgOrder


and don't forget quote with peek


regards

shanky1907
Creator II
Creator II
Author

I used the below code for order field and it is working fine:

if(Previous(eid)<>eid,1, peek(PrevOrgOrder) + 1) as PrevOrgOrder