Assign value to DataTable cell

Hi, everyone!
Making my first robot…
I tried to assign value to DataTable cell for several days, but couldnt. Searching for answer at this forum returned only something like this: " you can change the value via an assign: dtExample.rows(ObtainedIndex).item(“ColumnName”)= value`
"
But it doesnt work in my case:

Can someone help me?

Fine kindly try with this expression
dtExample.Rows(rowindex)(“yourcolumnname”) = “yourvalue”

make sure that the dtExample is a variable of type datatable
Cheers @Awa

5 Likes

Thanks for quick reply!
But everything looks correct but doesnt work. :frowning:
I cant upload my project couse I am newcomer, so can only post images:

1 Like

Fine
is that InternalTable is mentioned as output variable in the Build datatable activity in its property panel
and may i know what is the value in the VALUE part of assign activity
image

@Awa

Yes, InternalTable is output of BuildDataTable activity:

Great
what is the value of the counter in the assign activity in TO part
we need to have a default value assigned in the variable panel for counter like 0
@Awa

Value:

1 Like

kindly check once this pls


Cheers @Awa

image

I beleive that C# initialize not assigned int variables with 0 by default

no we need to initialize with a default value
even in c# if there is no value it will be as null and not 0
Cheers @Awa

I beleive that it will be null only for reference types, for value types it will be 0.
But anyway:

Fine
before the the FOR EACH activity use a assign activity and assign counter = 0
and remove this default value
and may i know what is the error showing now with the TO part of assign activity
@Awa

Done:

looks like my DataTable doesnt know anything about “Rows” or “row” methods, maybe I missed some namespace or something like that?

1 Like

Hmm
it looks perfect, but i wonder why it didnt work
may be we can try mentioning the default value as New System.Data.Datatable in the variable panel for the variable InternalTable

@Awa

something strange:

hmm
ok kindly import the namespace System.Data here in the import panel
image

@Awa

Sorry for keeping silence, my post limit was reached.

I have this namespace