Hi to add zero before a number?

Hi Uipath,

I need help about my problem.

let say I have the following data below:

image

as you can see the last row is Admin-RFP-2021-12-005.

what I am doing is saving it in a datatable and get the row number by using datatable.rows.count.tostring.

its only returning 6. what I want is to make it 006, 007, 008, and after reaching 10 it should become 010.

is it possible?

Thanks!

Try right(“000” + YourDT.rows.count.tostring, 3)

@aapostol

Try below expression.

   datatable.Rows.Count.Tostring.PadLeft(3, "0"c)

image

I got an error using it

Hi @aapostol
I hope this will be helpful to You…

one.ToString(“D3”)

Input is 1…
Ouput is 001…

Cheers!!

@aapostol

Can you please hover on that blue exclamation mark and show us the exact error. So that I can help you to resolve the issue.

I got this in the blue exclamation mark

image

Thanks!

@aapostol

You don’t need space after “0”

Thanks! it worked!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.