How to check the condition if particular column in excel is start with particular number then how to update the value in next column accordingly.
Suppose we have some data given as below:
And I want to add the condition here like if enrollment number is start with ‘1’ the need to update the status column as CONFIRM and if enrollment number is start with 2,then need to update the status column as NOT YET PROCESS and so on…
use read range to read the excel
use for each datarow to loop through the row
use if row(0).toString.StartsWith(“1”) then assign row(“Status”)=“CONFIRM”
else if row(0).toString.StartsWith(“2”) then assign row(“Status”)=“NOT YET PROCESS”
Read the range with ReadRange activity to Data table.
Then in a for each loop you can use string.startswith(“1”) and after that write the new values back
Something like this:
Hello @Riya1 Here like this total how many conditions are there?
If conditions are many, suggesting to use switch case activity activity.
1)use for each row in datatable
2)you can get the first value of the number using row(0).ToString.substring(0,1)
3)pass this switch. So case you have to create as 1, 2, 3 etc.
And you can use the write range to update the value after the case.
Find the workflow->
Sequence.xaml (10.2 KB)
I hope it will help you.
Can you please share a sample xaml?
Can you pls share snapshot of it? i am getting below screen only:
Can you pls share sample xaml?
Sequence (2).xaml (11.5 KB)
Please check if it works for you
Perform these steps->
Read your input Excel file.
iterate the datable.
use switch case and pass the vale in it.
I hope it will help you, let me know for any query.
Hi @Lak_Ui ,
I have to update a value in 4th column and have total 4 condition how can I achieve this?
All these 4 condition are based on startwith number or differnt conditions. instead of assigning the value in row(1) in the code i had shared you cn use row(3)
@Lak_Ui All conditions start with startwith number only.
Please share the sample xaml if possible.
Sequence (2).xaml (11.4 KB)
You can update this wf as per your conditions
Value is not updating against column.
you can change the code accordingly based on the column position or column name
for eg id column name is Status
you can use CurrentRow(“Status”) or if it is at 4 th position you can use CurrentRow(3) ie. position-1
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.