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

Announcements
Note: You may notice some temporary visual or styling issues in the Community. Our vendor is actively investigating.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Mass Comparison? Concatenate?

I have a table with users, privileges and privilege permissions.

user1privilege1Y
user1privilege2Y
user1privilege3N
user1privilege4Y
user1privilege5N
user2privilege1Y
user2privilege2Y
user2privilege3N
user2privilege4Y
user2privilege5N
user3privilege1N
user3privilege2Y
user3privilege3N
user3privilege4Y
user3privilege5Y

What I need to do is go through all these and find the users that have duplicate privilege sets, in this example, user1 & user2. Unless there is a better way, I would like to get a table that concatenates the privilege permissions for easy comparison in excel as shown below. Any suggestions?

user1YYNYN
user1YYNYN
user1YYNYN
user1YYNYN
user1YYNYN
user2YYNYN
user2YYNYN
user2YYNYN
user2YYNYN
user2YYNYN
user3NYNYY
user3NYNYY
user3NYNYY
user3NYNYY
user3NYNYY
1 Solution

Accepted Solutions
Not applicable
Author

Turns out all I needed was this:

 

TABLE4:

LOAD D_THESYSTEMKEY,

    CONCAT(PERMISSION) AS CONCATENATEDFIELD

RESIDENT Table2 GROUP BY D_THESYSTEMKEY;

View solution in original post

8 Replies
Not applicable
Author

even something like this would do just fine. any help, please?

privilege1privilege2privilege3privilege4privilege5
user1YYNYN
user2YYNYN
user3NYNYY
swuehl
MVP
MVP

Not applicable
Author

Hi,

please check my example, should work as expected.

Regards

Roland

Not applicable
Author

This looks like exactly what I need, Roland. What if instead of two values for the Y/N column, I have 25 values such as 01, 02, 03, 04... 23, 24, 25?

Not applicable
Author

Hi bikeking,

that depends what you want to achieve.

(you said: compare it in excel.) As I am not an excel-user it is not quite clear for me.

My first approach generates a field with all values concatenated like "01020304....".

I think this would be fine if all users have all values.

Otherwise:

An other aproach would be to use the "Generic Load" like swuehl suggested. Sth like:

RawData:

Generic

LOAD @1    AS User,

     @2    AS Privilege,

     @3 AS Value

FROM

[http://community.qlik.com/message/376723]

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

FOR i = 0 to NoOfTables()

  TableList:

  LOAD TableName($(i)) as Tablename AUTOGENERATE 1

  WHERE WildMatch(TableName($(i)), 'RawData.*');

NEXT i

// may be you want to put them together into the "first" table

// so it starts with 2 here:

FOR i = 2 to FieldValueCount('Tablename')

  LET vTable = FieldValue('Tablename', $(i));

  LEFT JOIN (RawData.privilege1) LOAD * RESIDENT $(vTable);

  DROP TABLE $(vTable);

NEXT i

Thanks to Rob Wunderlich for his always great postings.

HtH

Roland

Not applicable
Author

I'll have to go the concatenated field route - the excel sheet I imported for the generic load has 3 columns and 35,253 rows. You can imagine the mess of synthetic tables and fields that was created .

I was actually exporting the values from QlikView, so the data's already there in QlikView if that makes a difference. Also the "Y/N" column is an autogenerated column via the load script that has 36 values from "1" to "36":

Table2:

LOAD

       USER,
   
PRIVILEGE,
   
PERMISSION,
   
AutoNumber(PERMISSION) as DUPEFLAG
;

SQL SELECT *
FROM "My.TableA";

Table3:

LOAD

    PRIVILEGE,
   
PRIVILEGEDESCR

;

SQL SELECT

    PRIVILEGE,
    PRIVILEGEDESC
FROM "My.TableB;

I used DUPEFLAG since the permissions are a mix of letters, numbers and text strings (e.g. No Access). Either way, I just need to get that DUPEFLAG or PERMISSION field concantenated so I can get the equivalent of  USER1 - YNYYN etc. My apologies if I didn't give enough info in the beginning. Any further suggestions, though, now that you have an insight to my simple code?

Not applicable
Author

Any ideas?

Not applicable
Author

Turns out all I needed was this:

 

TABLE4:

LOAD D_THESYSTEMKEY,

    CONCAT(PERMISSION) AS CONCATENATEDFIELD

RESIDENT Table2 GROUP BY D_THESYSTEMKEY;