Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
micheledenardi
Specialist II
Specialist II

Rename duplicated Values

Dear all,

 i have a table like this:

Name
Mark
Julia
Mike
John
John
John

 

i want to rename all duplicated in order to have only distinct values to obtain

Name
Mark
Julia
Mike
John
John 2
John 3

 

How to do this?

thanks

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.
1 Solution

Accepted Solutions
tresesco
MVP
MVP

Try like:

Load *,
                Name& If(AutoNumber(RowNo(),Name)>1,AutoNumber(RowNo(), Name)) as NewName

Inline [
Name
Mark
Julia
Mike
John
John
John]

View solution in original post

3 Replies
Taoufiq_Zarra

Hi @micheledenardi 

One solution:

Data:

LOAD * INLINE [
    Name
    Mark
    Julia
    Mike
    John
    John
    John
];

Tmp:
noconcatenate

load *,if(rowno()=1,1,if(peek(Name)=Name,peek(n)+1,1)) as n resident Data order by Name;

drop table Data;


Final:
noconcatenate

load if(n=1,Name,Name&n) as Name resident Tmp;

drop table Tmp;

 

output :

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
tresesco
MVP
MVP

Try like:

Load *,
                Name& If(AutoNumber(RowNo(),Name)>1,AutoNumber(RowNo(), Name)) as NewName

Inline [
Name
Mark
Julia
Mike
John
John
John]

AbhijitBansode
Specialist
Specialist

Why can'y you append rowNo() with Name column:

 

Name&' '&RowNo() as distinctName