Why I always get the last row data when using "For Each" with web scaping?

@sandeep13
Like this? What kind of Variable type I should be using?
Thanks

@Cheatken
property of For each activity

you just to create variable interger type and use that variable in place of 0 like Row(index)

Thanks

1 Like

@Cheatken

FYI. Index property give us the current iteration index of for each loop

Thanks

1 Like

@sandeep13


Like This ?
image

Thanks

1 Like

@Cheatken yes ,right

1 Like

@sandeep13
Ok, I change the name a little so that it help me recognize index as integer variable.
Though it shows error “Cannot find column 1”

Thanks

@Cheatken
to access value form row object , use code like this
Row(int_indexRow)(“yourColumnname”)

I think in you case Row(int_indexRow)(“Date”)

@sandeep13
Seems like the syntax I use is not match somehow.
image
image

@Cheatken
could you please just check the value of Row(int_indexRow)(“Date”)

1 Like

@Cheatken

I found it, you just need to use column name like
Row(“yourColumnname”)

As I saw earlier you was using For each Activity and latest post I saw you are using For each row Activity
In the For each row activity we don’t need index Property because For each row itself current iteration index

Thanks

Ok, let me try
Thanks

@Cheatken was you check my email. I was unable to open your code. Can you simple send me Zip file.

@raja.arslankhan
Unfortunately I do not have Winzip.
Is it possible to send just the “main” instead?
Thanks

@Cheatken yeah sure please send me. Maybe it will be helpful

@raja.arslankhan
Ok I send another zip and main to you.
Thanks

@Cheatken Yeah, I received. Hope for best

I got it!
I need to use “Add Data Row” activity each time it get text from web. The data column need to be added in advance when create data table, not later on.
Thank you guys very much :slight_smile:

@Cheatken sorry, I have develop your code but forgot to upload. I will upload evening your optimize solution. Its best you have solved a problem with your own way. Happy learning

Main.xaml (166.3 KB)

Hi @Cheatken
I noticed your code is holding best practices, For Example you are building data table in loop.
Always build datatable outside loop.

Then you are adding number of columns in loop which will add every time. It should be in build table.

Last one you are not adding add row that’s why you are getting only last iteration value. This point you know already.

I am add here template of code. Not exact code due to your studio language.

ok Thank you :slight_smile: