How to achieve the below scenario

If the user gives the answer for qn 11 as ''No"(using Input Dialogue), then i should skip populating the question 12 and 13 - please refer the excel.

.

1 Like

Hi @KavithaManohar

What seems to be the problem you are facing here? Any error?

Well this workflow looks great and we need to add a write cell in the THEN part at last with range as “B”+counter.ToString
And a value as “No”
Are we facing any issue other than this
Cheers @KavithaManohar

while populating the questions through input dialogue if the answer for question 11 is given by user =NO, then I need should skip 12th(No. of Columns if overwrite) and 13th(Last Row of Data if Overwrite) questions in input dialogue, it should directly populate question"Population correctly formatted" - 14th question. Hope my explanation is clear now

image

I tried something like this to resolve and got this error:(

@KavithaManohar This error is because you just deleted something at a particular index and when you go for the next iteration the index changes to the previous index and the collection is modified.

for your iteration use Continue Activity as it skips the current iteration and goes to next iteration
eg: Ans=“No” and Count =11 or Count =12 in the IF else Mention Continue.

can You please send me an sample file

@KavithaManohar try like this

The main reason is that REMOVE DATA ROW activity
this error occurs when we are trying to delete or add any new row or column to datatable which is used currently in a for each row loop and bot wont allow to make changes or updates to that datatable if its in iteration inside a for each row loop activity

so you were almost done
but need to do some small changes like
–create a list variable of type int32 in the variable panel named list_datarrow and type as System.Collections.Generic.List(of int32) and default value as New List(of int32)
–now use a add to collection activity instead of that remove data row activity
where in the collection property mention as list_datarow and item as dt1.Rows.Index(row) and type argument as int32
–then after this for each row activity use a for each activity where pass this list variable as input and change the type argument as int32
–inside the loop use the REMOVE DATA ROW activity and in the row index mention as item and mention the datatable as well
–this will remove the rows in the datatable based on the row index stored in that list variable that we obtained from previous for each row loop

NOTE: But we should do this if we are going to write that datatable finally to a excel
and if so instead of write cell we need to use a assign activity in the ELSE part (of last image) and mention like this
row(1) = Result.ToString
which will assign the value to that row under column B
so once after all the iteration in for each row gets over we can right that updated datatable to the excel with write range activity where pass the datatable as input and sheetname we want and range as “” and make sure that the property ADD HEADERS is enabled

thats all you are done
hope this would help you

Cheers @KavithaManohar

can u please share me the sample file which u explained- related to this scenario please.

I tried reproducing the same as per ur instructions, but i am facing some validation issues…let me know where I am going wrong please.