Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator II
Creator II

Need to avoid duplicate value in load script

Hi friends,

I'm loading employee no and their status in load script. But some employee number having two status(Active and Removed). In that case i want to load only 'Removed ' status for that Employee in load script.

Kindly find the Below screenshot for reference. Any help will be much appreciated.Qlikcommunity.png

1 Solution

Accepted Solutions
Highlighted

Re: Need to avoid duplicate value in load script

Alternatively, you can try this

Table:

LOAD * INLINE [

    Empl No, Status

    1, Active

    2, Removed

    3, Active

    3, Removed

    4, Removed

    5, Active

];


Right Join (Table)

LOAD [Empl No],

MaxString(Status) as Status

Resident Table

Group By [Empl No];

View solution in original post

6 Replies
Highlighted

Re: Need to avoid duplicate value in load script

Try like this

Table:

LOAD *,

Match(Status, 'Active', 'Removed') as StatusNum;

LOAD * INLINE [

    Empl No, Status

    1, Active

    2, Removed

    3, Active

    3, Removed

    4, Removed

    5, Active

];


Right Join (Table)

LOAD [Empl No],

Max(StatusNum) as StatusNum

Resident Table

Group By [Empl No];

Highlighted
Creator II
Creator II

Re: Need to avoid duplicate value in load script

Sunny,

Im getting number 2 instead of Removed. Kindly tell me what am i done wrong?

Highlighted

Re: Need to avoid duplicate value in load script

For StatusNum... you might be getting 2, but status should be Removed

Capture.PNG

Highlighted

Re: Need to avoid duplicate value in load script

Alternatively, you can try this

Table:

LOAD * INLINE [

    Empl No, Status

    1, Active

    2, Removed

    3, Active

    3, Removed

    4, Removed

    5, Active

];


Right Join (Table)

LOAD [Empl No],

MaxString(Status) as Status

Resident Table

Group By [Empl No];

View solution in original post

Highlighted
Contributor
Contributor

Re: Need to avoid duplicate value in load script

Hi praveen

Try this. You will get one Record if it is Removed.

load

[Empl no],

maxstring(Status) as  Status

From

Group By [Empl no];

Highlighted
Creator II
Creator II

Re: Need to avoid duplicate value in load script

Exactly what i want. Thank you so much for your Knowledge.