How to create a running number

Dear All,

Seek your expertise.

I would like to input a sequence or case number, it should work by running number with email send.

Possible to do by uipath? for example the email subject should [date+running number+input wording]

I manage to input date+wording, looking for a solutiong where it would be look like [2207-ABC-001] and following by 002 onwards…

Hope it is not confusing

Thanks.

Yes it is possible. I am guessing you would like your running number to be continuous each time the RPA runs. In that case you would need to save your current running number somewhere, could be a text file. During each run RPA will read the text file and assign the current value to integer (intRunningNumber).
Assign intRunningNumber = intRunningNumber + 1 (if you have a loop then this should be inside the loop so that the running number increments for each item)
Then your subject would have your usual contents and then append the intRunningNumber.
At the end of the run, write back the intRunningNumber to your text file for usage on the next run.

Hey!

Try like this

Create one int variable

Initialize with 0

Then use the counter like this

Casenumber+(Counter+1).ToString

At the and inside the for loop use like this

Counter=Counter+1

This will change the number in each iteration

Regards,
NaNi

Hi Ave, Nani,

Thank you both for your idea given.

i have somehow assign casenumber=casenumber+1 to assign activity.
image

then input under editor
image

somehow i do not get the running number, guess i was doing it wrongly.

Kindly advise.

Thanks!

Hey!

First we need initialize the counter with 1

then take the for each inside for each we need to increment the counter

FYI:

In this example i have used While loop…

You can use any loop - (For, While, Do-While or For each row in data table)

inside the loop you have to increment

So, your case should be like this

"["+TodayDate+"-"+Row("Vendor").ToString.Trim+"-"+(CaseNumber+1).ToString+"]"+Request for Quotation: +Row("item Category").ToString.Trim

Regards,
NaNi

Hi Nani,

seems like im still failed to do it, could you help with my xaml sample and data number case sheet.

RFQ.xaml (21.6 KB)

excel sample
RunningNumber.xlsx (62.2 KB)

test sample
RunningNumber.txt (28.3 KB)

Regards,

Hello @Alfred_Gan May I know why did you save the running number in a xlsx and text file. Are you trying to read from those files. Please explain

Hi Ushu,

Thought i could bring these number into running number as per email subject.

Not sure if im doing it right.

Need solution to make this running work in every each of email being sent as it would have multiple emails address and details.

Regards,

Hello @Alfred_Gan I have made some changes to your xaml. Please test with it

RFQ.zip (3.6 KB)

OR

RFQ.xaml (24.7 KB)

Hi Ushu,

Thank you for helping, it works as in like i have 10 email, it somehow will add in number from 1-10 at the back,

how about if i continue to send more, it does not continue from 11-20 and so forth…

This is my objective to achieve the running numbers.

Regards,

Hey!

Which loop are you using?

If this is while loop or Do while… We can do like this Dt.RowsCount>0

OR

We can replace it with For loop

This won’t Stop until there is no data available

Can we try this?

Regards,
NaNi

Hello @Alfred_Gan Did you run the process. Also,as per my understanding you want to start the numbering form 001- continues is that right ??

Hi @ushu Yes i ran the process and it work in sequence number like 1-10, however i tried to send again it will start over again from 1-10,

says i have more data to send in the near future, it shall goes on with the following numbers, something like that…

Hello @Alfred_Gan It should continue with the following numbers. I guess there is something wrong with the variable scope. Can you share your variables panel screenshot (something like below one)at where the case number is defined

Hi @ushu herewith the xaml file again for.

RFQ.xaml (22.5 KB)

and variable as follow per your sample earlier.

image

Hi @ushu, and All,

Good day. Just to follow up if there is any solution for this.

Regards,

If you initialise your CaseNumber variable in your code as 001, then every time the process runs it will start from 001. In order to have some persistence between executions you need to store the value of this counter somewhere else.

You could do this in many places, a text file, a spreadsheet, a storage bucket etc… where is up to you, so long as it’s somewhere that persists between runs. To keep things simple, maybe just start with a text file containing your initial value 1.

Your code could read the text file and assign the value of the text file to your CaseNumber variable. So the first time, this would be 1.

Then for each email, increment your CaseNumber variable as you go, but write the updated CaseNumber value back to your text file. So after the first email, your text file will now contain 2, then 3, and so on and so forth.

This way, whenever your code runs, it will get the CaseNumber value from your text file, which should contain whatever the last CaseNumber was when your code last ran.

Hi @moosh possible to have sample for this sequence?

i have tried the method as recommended above from all but somehow it seems difficulty for me and understand and come out the flow…

Regards,

Hi,

Lets say i wanted to check the column B, if no data, use the number,

If it already use, then tag something like “used” at column B,

Uipath should only take sequence number that did not have tag on column B

How should i do that?
RunningNumber.xlsx (62.3 KB)

Thanks.

Something like this example: