How to update specific row in data table

Hi guys,
I have a table with phone numbers as phone_table={911111111111,2222222222,913333333333,914444444444,5555555555}. now i have to add 91 before the 10 digit phone numbers… and i have to update the phone_table. The output should be like phone_table = {911111111111, 912222222222, 913333333333, 914444444444, 915555555555}.

Please guys help me if you know

Hi @Sunitha_Bist,

You need to loop through entire datatable using “For each row” activity and then in the sequence you need use assign as :

row(0).ToString = “91” + row(0).ToString
row(1).ToString = “91” + row(1).ToString
row(2).ToString = “91” + row(2).ToString
.
.
row(n).ToString = “91” + row(n).ToString

for all the columns.

Regards,
V

2 Likes

hi vikas.Jain
Thanks for your reply,
I dont need for all the rows because some will have by default as 91… So i gave If condition over there as if(row(0).ToString=10) then row(0).ToString = “91” + row(0).ToString… my question is that, how can i update in phone_table and it is not in column… it is in row wise in table

@Sunitha_Bist, A table will surely have column and rows.

However with the example you have given, You can split the elements on the basis of “,” into an array/list, then append it with 91 and finally, assign it back to the same array or list.

Regards,
V

2 Likes

thank you vikas.jain… it worked for me

Here Take that all data into DataTable…Run a “For each Loop” for the data table and check
length=row(0).ToString.Length
if(length>10){
//Leave it

else

row(0)=“91”+row(0).ToString

}

Try with this it will work…

Hai Vikas,jain corejava.xlsx (10.6 KB)
from this excel sheet if row consist of some list of string which we gives in array like {“difference” , “between”, “explain”}if this word consist in row.item(0)the status to be updates as “yes”
i cant do update in row.item(1) so please help me