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: 
Not applicable

Link two fields from one table, to one field in the other

Hey, run into a small problem that I hope is easily solved.

So I've got one table that has TableID, AllocatedWorkerID, ReportedWorkerID.

The Allocated and Reported IDs are linked to the same table, which is Users, and are linked by UserID.

I need to be able to see what user reported the work, and what user has been allocated the work, so I can't just load them both "as UserID" or anything, so I'm a bit stumped at the moment.

Also the database is designed by someone else, and do not have the ability to change the architecture of it.

Thanks for any help.

1 Solution

Accepted Solutions
Not applicable
Author

Hey Joseph,

If i understood correctly you want the Actual Names for AllocatedID and ReportedID fields from the User table using UserID field.

If this is the case you can use applymap() function. Something like this:

Mapping_Table:

Mapping

Load Distinct

UserID,

UserName

From User.qvd(qvd);

Actual_Table:

Load *,

Applymap('Mapping_Table',AllocatedID,'Missing :'&AllocatedID) as [Allocated Worker],

Applymap('Mapping_Table',ReportedID ,'Missing :'&ReportedID ) as [Reported Worker]

From Actual_Table.qvd(qvd);

Hope it helps

Thanks

AJ

View solution in original post

4 Replies
chiru_thota
Specialist
Specialist

You can load user Dimension table twice and rename columns.

Then your  problem will be solved.

Not applicable
Author

Hey Joseph,

If i understood correctly you want the Actual Names for AllocatedID and ReportedID fields from the User table using UserID field.

If this is the case you can use applymap() function. Something like this:

Mapping_Table:

Mapping

Load Distinct

UserID,

UserName

From User.qvd(qvd);

Actual_Table:

Load *,

Applymap('Mapping_Table',AllocatedID,'Missing :'&AllocatedID) as [Allocated Worker],

Applymap('Mapping_Table',ReportedID ,'Missing :'&ReportedID ) as [Reported Worker]

From Actual_Table.qvd(qvd);

Hope it helps

Thanks

AJ

Anonymous
Not applicable
Author

CrossTable(TypeOfWork,UserID)

LOAD TableID,

     AllocatedWorkerID,

     ReportedWorkerID

Resident tabla1;

LOAD UserID

     Name

FROM Users;

Not applicable
Author

Thanks for answers everyone, but this is the one I tried first and it worked absolutely perfectly.

Thank you so much.