I want to use right cell activity using counter mechanism

In the specified process, I’m using “Write Cell” activity (Classic). I want to use counter mechanism to increment from specified cell (F6) how should I do it.

I don’t want to use modern activity.

Thankyou

@Bhushan_Nagaonkar

If you have a counter then use "F" + (counter+6).ToString

Assuming counter starts from zero

If inside for loop then use index preoprty in for loop to get the counter

Hope this helps

Cheers

@Bhushan_Nagaonkar

You can use For Each row activity, in properties you can create a variable for Index
Now you can write in acitivity as “A” + (Index +1).ToString

Hope this may help you

Thanks,
Srini

@Srini84 My counter value is pdf page number. It starts from 1 so should I assign.

Should it be
Pdfpageno = Pdfpageno + 1

If Im using while condition
Pdfpageno >0

@Bhushan_Nagaonkar

If you are using Do while condition then
You can use your PDFpage counter only
So the PDF page counter starts with with 1 then you don’t need of +1 to add

Hope this will help you

Thanks,
Srini

Ok, Thankyou I’ll try let you know

@Bhushan_Nagaonkar

I guess your condition should be pageno <= totalpagecount

Else the bot would run for infinite loop as the page no will always be >0

Cheers

Ok, I’ll try to add this condition as well and let you know thankyou

1 Like

Is this correct or do I have make any changes.
Extract pdf gives the count of page. I want to loop activity that many times.

There is one string that I want to write into cell according to page count of pdf

@Anil_G @Srini84.

@Bhushan_Nagaonkar

Are you decrementing the extrapdfcount variable?

If not again the loop will be infinite

Cheerd

In this I want to write
if page count 3 then I want to write in F6,F7,F8

@Bhushan_Nagaonkar

Then use for loop with enumerable.Range(6,pagecount).ToArray then it runs from 6 to 8 and can be used inside the activity

Cheers

What is Csn?

And should I write that condition in.loop or cell range?

The value I want to write is not extracted from pdf.

In excel the value is

Header
ABC

I want to write ABC depending on pagecount

Sorry For not explaining it properly. I will work on that

Thankyou

@Bhushan_Nagaonkar

If using while loop then condition must include to add a counter and chekc the counter number

Else use for loop with above condition

Cheers

Is this correct

hi @Bhushan_Nagaonkar ,

Greetings!

Lets says you are reading the data from a txt or pdf file, if you have say 4 lines, you wanna write the values in F6,F7,F8,F9.

For this I can suggest you two options.

  1. Assign counter for values fetched. For example: data_counter=4;
  2. Assign excel_counter=0;
  3. While excel counter<data_counter
  4. write cell with cell value as “F”+(excel_counter+6).toString and value whichever it is that you wanna write.
  5. increment excel_counter with 1
  6. exit loop.

or
if you wanna do the writing part at once in the end of each file

  1. Build Data Table: DataToBeWritten with 1 column called Value.
  2. While excelCounter<dataCounter
  3. Add DataRow to DataToBeWritten,
  4. Increment excelCounter .
  5. exit Loop.
  6. Write Range. pass range as “F6” and DataToBeWritten as Datatable.

That might help you up!!

Thanks
Aditya

@Bhushan_Nagaonkar

This should be passed in in argument and not in index

Cheers

I will try both of them @adiijaiin & @Anil_G thanks

2 Likes

I tried solution from both of you. It didn’t work.

Maybe I didn’t phrase it right.

Let me Rephrase -

I have to read page count of pdf. The variable I used is “extractpdf” to get the count. I want to use “extractpdf” as counter to auto increment write cell classic activity.

The autoimcrementing value is type String. Which I will read from excel

For eg

Header
ABC

If extractpdf is 1/2/3 then I want to write in excel sheet Range is F6.

If “extractpdf” gets the page count as 2 it should write in CELL F6&F7 simultaneously.

If 3 then F6/F7/F8.

Sorry for inconvenience caused.

Thankyou

@Bhushan_Nagaonkar

As I understamd uou want to use write cell in aloop for those many times as the extract pdf count would be

For that follow the steps

  1. Use pdf page count to get count in variable extractpdfcount
  2. Now use a for loop …I hope you need tos tart from row 6 always…if yes… then use in argument of for loop as Enumerable.Range(6,extractpdfcount).ToArray and change type argument to integer(or in latets generally automatically it would take if not degrade to 22.10 or use .Cast(of integer)
  3. Inside for loop use write cell and give cell values as "F" + currentitem.ToString

Hope this helps

Cheers

1 Like