Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

ApplyMap() ?

Hi all,

i have the following situation:

Two tables:

users:

User_IDQuarterHoursBonus_ID
123Q1-20111221
224Q1-20111031
234Q2-2011972

bonus:

Bonus_IDFrom_HoursTo_HoursBonus
17510075%
1101125100%
27910475%
2105130100%

What i want (in my LOAD script):

I want to determine the correct bonus for each user based on the user's hours. I assume i have to check in which interval the users.Hours value falls when looing at the bonus table...but i am not sure how to do this - Can anyone help out or give me a hint ?

Thanks a lot.

K

1 Solution

Accepted Solutions
Not applicable
Author

Please eleminate the DROP FIELD statement in script (comment it out).

Hope you get the result you want !

Rainer

View solution in original post

6 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Have a look at the application attached here with.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

Thanks a lot for the prompt feedback.

I see only one problem: I have more than one bonus scheme (Bonus_ID); if i e.g. select user 123 i get to possible records in the interval table (for the same hours but one for each Bonus_ID), but it should be only one record / one bos as the user 123 is linked to Bonus_ID 1...

swuehl
MVP
MVP

Use the extended syntax for interval match, like

BONUS:

LOAD From_Hours,

     To_Hours,

     Bonus_ID, 

     Bonus

FROM

[http://community.qlik.com/thread/46676?tstart=0]

(html, codepage is 1252, embedded labels, table is @2);

USERS:

LOAD User_ID,

     Quarter,

     Hours,

     Bonus_ID

FROM

[http://community.qlik.com/thread/46676?tstart=0]

(html, codepage is 1252, embedded labels, table is @1);

join Intervalmatch (Hours, Bonus_ID)

LOAD From_Hours, To_Hours, Bonus_ID Resident BONUS;

left join load * resident BONUS;

drop table BONUS;

drop fields From_Hours, To_Hours,

Hope this helps,

Stefan

Not applicable
Author

Hi,

please see the attached example (includs your data).

Good luck!

Rainer

Not applicable
Author

Thanks a lot!

This seems only to work though with the current set of data. If i add a line to the xls sheet - e.g. a record for user 123 and Q2-2011 having worked 99 hours (Bonus_ID = 1), i get 2 results (75 & 100) for 99hours for user 123 in Q2 2011...

Not applicable
Author

Please eleminate the DROP FIELD statement in script (comment it out).

Hope you get the result you want !

Rainer