Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
if user in multiple groups and we have group priority then how can we remove it from other group based on priority
eg
User table
UserId, Groupid
aaa ggg
aaa bbb
ccc hhh
ccc bbb
priority group tbl
ggg 1
bbb 2
hhh 3
result would be
UserId, Groupid
aaa ggg
ccc bbb
How do we achieve ?
You need create a "number" property in your GroupId and get only the MIN. Then the field will have two values: number and text. Like "month" or other "date" fields.
T1:
LOAD * Inline [
UserId, GroupId
aaa, ggg
aaa, bbb
ccc, hhh
ccc, bbb
];
Left Join (T1)
LOAD * Inline [
GroupId, Priority
ggg, 1
bbb, 2
hhh, 3
];
Table:
LOAD
UserId,
MinString( Dual(GroupId, Priority) ) as GroupId
Resident T1
Group By UserId;
Drop Table T1;
Did the post help you with your use case? If so, do not forget to return to things and use the Accept as Solution button on the poster's thread to give them credit for the assistance and let other Community Members know things worked. If you are still trying to sort things out, please leave an update with what you still need.
Regards,
Brett