Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I want to replace a name with a unique reference number. Is this possible?
see example below
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 |
I want to create 'Annon' column based on the name See above.
Any thoughts?
Regards
Phil
Hi Phil,
May be use Autonumber(Name)?
Regards,
Andrey
try below
1000+rowno() as Annon
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;
Try using Autonumebr function
Eg. Autonumber(FieldName) as Annon
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;
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
So Simple. Thanks guys !