Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Adding text numbers with Leading 0

Hello!  I hope someone can help me on this.  I want to add 2 fields in text  and number format.  However , I want the results in text format with leading 0 as shown below "Result"  column...Thus, the results should be in Seq field format.

I tried  Text(Num(Seq+counter,Repeat('0',Len(Seq))))  to no avail ...

   

SeqcounterResult
000410005
0032005
02103
123
213
00005200007

Thank you in advance.

1 Solution

Accepted Solutions
tamilarasu
Champion
Champion

Hi Caroline,

Try this,

Text(Num(Num#(Seq,'#') + counter, Repeat('0',Len(Seq))))

View solution in original post

14 Replies
vishsaggi
Champion III
Champion III

What is the problem with your expr? This is what i am getting when i use your expr?

LOAD *, Text(Num(Seq+counter, Repeat('0',Len(Seq)))) As Result INLINE [

Seq, counter

0004,  1

003,   2

02,   1

1,   2

2,   1

00005, 2

];

Capture.PNG

Anil_Babu_Samineni

Good solution, But why third one shows normally again ??

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
Anil_Babu_Samineni

Will you provide real values?

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

Hi! Vishwarath ,

My Seq column is in text format.  Anyway, How did you make it to number and keeping the leading 0s?

Tks.

Anonymous
Not applicable
Author

Hi!  Anil,

Like this?

   

SeqcounterOutput
01102
000210003
000110002
000210003
0021003
01102
12

3

Anil_Babu_Samineni

Your expression perfectly works until unless Unique Seq is not in the list. So, Could be issue over there. Let me recommend one person who is do some good job marcowedel

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
vishsaggi
Champion III
Champion III

Oops I missed it.

tamilarasu
Champion
Champion

Hi Caroline,

Try this,

Text(Num(Num#(Seq,'#') + counter, Repeat('0',Len(Seq))))

vishsaggi
Champion III
Champion III

Try this?

LOAD Text(Seq) as Seq, counter,Text(Num(Seq+counter, Repeat('0',Len(Seq)))) As Result INLINE [

Seq, counter

0004,  1

003,   2

02,   1

1,   2

2,   1

00005, 2

];