Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Autonumber Based on Suffix

Hello!

Is it possible to create an autonumber  but based on the suffice's  text format? They're different bec the designated field "NewMatcode" requires only 18 char or below . Thus, the suffix varies .

I tried to get the max based on the last subfield format like '0006'  using  below but did not work...

max(Num(SubField(Matcode, '-',-1),Repeat('0',Len(SubField(Matcode, '-',-1))))) 

I also tried to generalized all suffix into 4 digits like 0006...but the problem is some items would exceed to18 char. Is there other ways that suffix will auto adjust based on 18 char?

Pls. see example below :

   

Pls. help.

5 Replies
luismadriz
Specialist
Specialist

Hi Caroline,

I don't think I understand your request, can you please write the MatCode as it comes and the NewMatCode as you would like to have it?

Cheers,

Luis

Anil_Babu_Samineni

Why Last 2 rows showing 4 and 5 instead 2 and 5??

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

try this ...

Load AutoNumber(SubField(Matcode,'-',-2))&'-'& SubField(Matcode,'-',-1)as NewAutonumber,
Matcode
;
Load * Inline [
Matcode
A1-10-357
A1-10-358
B1-20-400
B1-20-401
C1-30-500
C1-30-501
D1-40-600
]
;

Anonymous
Not applicable
Author

hi!  Anil,

If you look at B1-1009375-16-CY-1 and B1-1009375-16-CY-3...The max suffix is 3.  Therefore, the next suffix number to be used would  be 4 ..

Rgvds

Anil_Babu_Samineni

Clear, I am going to work now. Will you provide that excel ?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful