Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Please check given below required input table and required output table. I am looking for solution which must generate unique record number for each record but whenver Tproduct change or new one come then Titem number must reset and start from 1.
Required Input | |
Tproduct | Titem |
P1 | T1 |
P1 | T2 |
P1 | T1 |
P1 | T3 |
P1 | T4 |
P1 | T2 |
P1 | T1 |
P2 | T1 |
P2 | T2 |
P2 | T1 |
P2 | T3 |
P3 | T4 |
P3 | T2 |
P3 | T1 |
--------------------------------------------------
Required Output | ||
Unique ID | Tproduct | Titem |
P1-T1 | P1 | T1 |
P1-T2 | P1 | T2 |
P1-T3 | P1 | T1 |
P1-T4 | P1 | T3 |
P1-T5 | P1 | T4 |
P1-T6 | P1 | T2 |
P1-T7 | P1 | T1 |
P2-T1 | P2 | T1 |
P2-T2 | P2 | T2 |
P2-T3 | P2 | T1 |
P2-T4 | P2 | T3 |
P3-T1 | P3 | T4 |
P3-T2 | P3 | T2 |
P3-T3 | P3 | T1 |
Thanks
May be this?
Tproduct & '-' & Left(Titem,1) & AutoNumber(RecNo(),Tproduct) as [Unique ID]
May be this?
Tproduct & '-' & Left(Titem,1) & AutoNumber(RecNo(),Tproduct) as [Unique ID]
Hi Anil,
Please tell me how it is working Autonumber()?
AutoNumber(RecNo(),Tproduct)
Why this line of code is generating unique number.
Thanks,
Have a look autonumber - script function ‒ QlikView
Autonumber(), Recno(), rowno()
Note - If applicable, please close this thread or ask if still not resolved.
Hi Anil,
I would like to know technically, How it is working?
Thanks,
In fact, I believe sujjeth gave with some screenshots. I am not a good tutor to explain. Some how?
Tproduct & '-' & Left(Titem,1) & AutoNumber(RecNo(),Tproduct) as [Unique ID]
Let's bifurcate to each what actually doing here is
Tproduct & '-' & Left(Titem,1) returns
Tproduct Titem Output
P1 T1 P1-T
AutoNumber(RecNo(),Tproduct)
For "Tproduct" unique rows it will generate the sequence numbers till row got changed from 1 to total sequence rows of each unique. That is how "Autogenerate" works for "AutoNumber". Instead of asking, Why can't you think by yourself to understand the sequence