Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Highlighted
philmywallet
Contributor

Anonymise Names with Unique Ref

Hi

I want to replace a name with a unique reference number.  Is this possible?

see example below

 

DateNameAmountAnnon
01/04/2017Sam Smith1001234
02/04/2017Joe Bloggs505678
02/04/2017Sam Smith1501234
03/04/2017Peter Potter209876
03/04/2017Joe Bloggs1005678

I want to create 'Annon' column based on the name See above.

Any thoughts?

Regards

Phil

Tags (2)
1 Solution

Accepted Solutions
ahaahaaha
Honored Contributor

Re: Anonymise Names with Unique Ref

Hi Phil,

May be use Autonumber(Name)?


Regards,

Andrey

7 Replies
ahaahaaha
Honored Contributor

Re: Anonymise Names with Unique Ref

Hi Phil,

May be use Autonumber(Name)?


Regards,

Andrey

Re: Anonymise Names with Unique Ref

try below

1000+rowno() as Annon

Chanty4u
Esteemed Contributor III

Re: Anonymise Names with Unique Ref

just try this

aa:

LOAD * INLINE [

    Date, Name, Amount, Annon

    01/04/2017, Sam Smith, 100, 1234

    02/04/2017, Joe Bloggs, 50, 5678

    02/04/2017, Sam Smith, 150, 1234

    03/04/2017, Peter Potter, 20, 9876

    03/04/2017, Joe Bloggs, 100, 5678

];

Result:

LOAD *

,

AutoNumber(Name) as Result

Resident aa;

uniq.PNG

md_qlikview
Contributor II

Re: Anonymise Names with Unique Ref

Try using Autonumebr function

Eg. Autonumber(FieldName) as Annon

Re: Anonymise Names with Unique Ref

Although AutoNumber is a quick and easy option, here is another one which will probably give better performance on larger dataset

Table:

LOAD Date,

     Name,

     Amount

FROM ....;

FinalTable:

LOAD Date,

     Name,

     Amount,

     If(Name = Previous(Name), Peek('Annon'), RangeSum(Peek('Annon'), 1)) as Annon

Resident Table

Order By Name;

DROP Table Table;

tomasz_tru
Valued Contributor

Re: Anonymise Names with Unique Ref

Autonumber can give you different representation of Name when reloading the data. If you want to have permanent Name<>Annon connection, use hashing functions: Hash128 ‒ QlikView

Tomasz

philmywallet
Contributor

Re: Anonymise Names with Unique Ref

So Simple.  Thanks guys !