Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
prahlad_infy
Partner - Creator II
Partner - Creator II

Help me to code script for merging multiple records with condition ?

HELLO SIRS ,

Please help me on the below output to get ,

Merging with condition.PNG

Combination to Get Final Field

IF TIER IS = O  AND Area is Geologics then Final Field will be Geological

IF TIER IS = Z   AND Area is Growth then Final Field will be Growth

IF TIER IS = B   AND Area is Fashion then Final Field will be Fashion

IF TIER IS = A   AND Area is Fashion then Final Field will be Textile Technology & Fabrics

Data :

Data:

LOAD * INLINE [

    Conference_Id, Date, Speaker, Area, Tier, Company, Room_Nbr

    108-23-6686, 22-08-2017, Pernell Vayne, Climate, Tier C, Riffpath, Ball Room 6

    108-23-6686, 22-08-2017, Jeannine Wickett, Geologics, Tier O, JumpXS, Ball Room 6

    108-23-6686, 22-08-2017, Israel Davidson, History, Tier C, Tagchat, Ball Room 6

    108-23-6686, 22-08-2017, Ed MacCarlich, Climate, Tier C, Wikizz, Ball Room 6

    108-23-6686, 22-08-2017, Gerri Elbourne, Climate, Tier C, Feedfire, Ball Room 6

    108-23-6686, 22-08-2017, Adan Anthonsen, Geologics, Tier O, Fiveclub, Ball Room 6

    500-37-5569, 23-08-2017, Rhea Tuxell, Inflation, Tier X, Kare, Ball Room 7

    500-37-5569, 23-08-2017, Pernell Vayne, Inflation, Tier X, Thoughtsphere, Ball Room 7

    500-37-5569, 23-08-2017, Jeannine Wickett, Jobs, Tier Q, Youbridge, Ball Room 7

    500-37-5569, 23-08-2017, Israel Davidson, Growth, Tier Z, Blogtags, Ball Room 7

    108-23-6689, 24-08-2017, Cordelia Brunt, Fashion, Tier B, Blognation, Ball Room 11

    108-23-6689, 24-08-2017, Ed MacPEARSON, Textile, Tier A, Aimbu, Ball Room 11

    500-37-2222, 25-08-2017, Ceciley Cushion, Growth, Tier X, Blogtags, Ball Room 1

    500-37-2222, 26-08-2017, Gracia Cheek, Fashion, Tier A, Blognation, Ball Room 1

    500-37-2222, 27-08-2017, Cale Curuclis, Textile, Tier A, Aimbu, Ball Room 1

];

I have mereged the records but how to get last field ?

Thank you

1 Solution

Accepted Solutions
Anonymous
Not applicable

May be something like this

IF( WildMatch(Concat( DISTINCT  Tier, ' ,'), '*Tier O*')  AND WildMatch(Concat( DISTINCT  Area, ' ,'), '*Geologics*'), 'Geological',

IF( WildMatch(Concat( DISTINCT  Tier, ' ,'), '*Tier Z*')  AND WildMatch(Concat( DISTINCT  Area, ' ,'), '*Growth*'), 'Growth',

IF( WildMatch(Concat( DISTINCT  Tier, ' ,'), '*Tier B*')  AND WildMatch(Concat( DISTINCT  Area, ' ,'), '*Fashion*'), 'Fashion',

IF( WildMatch(Concat( DISTINCT  Tier, ' ,'), '*Tier A*')  AND WildMatch(Concat( DISTINCT  Area, ' ,'), '*Fashion*'), 'Textile Technology & Fabrics'))))

View solution in original post

11 Replies
Anonymous
Not applicable

May be something like this

IF( WildMatch(Concat( DISTINCT  Tier, ' ,'), '*Tier O*')  AND WildMatch(Concat( DISTINCT  Area, ' ,'), '*Geologics*'), 'Geological',

IF( WildMatch(Concat( DISTINCT  Tier, ' ,'), '*Tier Z*')  AND WildMatch(Concat( DISTINCT  Area, ' ,'), '*Growth*'), 'Growth',

IF( WildMatch(Concat( DISTINCT  Tier, ' ,'), '*Tier B*')  AND WildMatch(Concat( DISTINCT  Area, ' ,'), '*Fashion*'), 'Fashion',

IF( WildMatch(Concat( DISTINCT  Tier, ' ,'), '*Tier A*')  AND WildMatch(Concat( DISTINCT  Area, ' ,'), '*Fashion*'), 'Textile Technology & Fabrics'))))

prahlad_infy
Partner - Creator II
Partner - Creator II
Author

Sir , Since my data in real time is huge , i wanted to handle more using script than SET EXPRESSION .. If you can hlep me on those lines

petter
Partner - Champion III
Partner - Champion III

You only have to make some minor changes - adding something to the data model and adding a third parameter to each of you Concat() expressions in your table:

2018-08-19 09_55_36-QlikView x64 - Evaluation Copy - [C__Users_Petter_Downloads_Merging with conditi.png

2018-08-19 09_57_19-Edit Script [C__Users_Petter_Downloads_Merging with condition.qvw].png

prahlad_infy
Partner - Creator II
Partner - Creator II
Author

mapping conference id to final field is not correct way i believe , because in real time i will have millions of conferences and final field depends on Tier & Area combination

petter
Partner - Champion III
Partner - Champion III

Then you can just make the correct key between them by having a composite key or concatenated keys involving the right fields. Should be an easy adjustment.

petter
Partner - Champion III
Partner - Champion III

Here is a suggestion for a solution that also shows how it can be done in a load script:

2018-08-19 10_18_41-Edit Script [C__Users_Petter_Downloads_Merging with condition.qvw_].png

2018-08-19 10_16_21-Microsoft Edge.png

petter
Partner - Champion III
Partner - Champion III

Actually this is a good argument for having a separate associated table or doing a ApplyMap() with a Mapping Load. Having explicit If's would be very unmanageble for that volume of data...

Anonymous
Not applicable

The  task is not quite clear, but you can get the above result even in this way

Data:

LOAD * INLINE [

    Conference_Id, Date, Speaker, Area, Tier, Company, Room_Nbr

    108-23-6686, 22-08-2017, Pernell Vayne, Climate, Tier C, Riffpath, Ball Room 6

    108-23-6686, 22-08-2017, Jeannine Wickett, Geologics, Tier O, JumpXS, Ball Room 6

    108-23-6686, 22-08-2017, Israel Davidson, History, Tier C, Tagchat, Ball Room 6

    108-23-6686, 22-08-2017, Ed MacCarlich, Climate, Tier C, Wikizz, Ball Room 6

    108-23-6686, 22-08-2017, Gerri Elbourne, Climate, Tier C, Feedfire, Ball Room 6

    108-23-6686, 22-08-2017, Adan Anthonsen, Geologics, Tier O, Fiveclub, Ball Room 6

    500-37-5569, 23-08-2017, Rhea Tuxell, Inflation, Tier X, Kare, Ball Room 7

    500-37-5569, 23-08-2017, Pernell Vayne, Inflation, Tier X, Thoughtsphere, Ball Room 7

    500-37-5569, 23-08-2017, Jeannine Wickett, Jobs, Tier Q, Youbridge, Ball Room 7

    500-37-5569, 23-08-2017, Israel Davidson, Growth, Tier Z, Blogtags, Ball Room 7

    108-23-6689, 24-08-2017, Cordelia Brunt, Fashion, Tier B, Blognation, Ball Room 11

    108-23-6689, 24-08-2017, Ed MacPEARSON, Textile, Tier A, Aimbu, Ball Room 11

    500-37-2222, 25-08-2017, Ceciley Cushion, Growth, Tier X, Blogtags, Ball Room 1

    500-37-2222, 26-08-2017, Gracia Cheek, Fashion, Tier A, Blognation, Ball Room 1

    500-37-2222, 27-08-2017, Cale Curuclis, Textile, Tier A, Aimbu, Ball Room 1

];

Left Join

LOAD * INLINE [

Tier,        Area,            Final_Area_Of_Discussion

Tier O,     Geologics,      Geological

Tier Z,      Growth,          Growth

Tier B,      Fashion,        Fashion

Tier A,      Fashion,        Textile Technology & Fabrics

];

shekhar_analyti
Specialist
Specialist

Is this what you are looking for ? FYI ... I have not used Any Set expression .

pic.jpeg