Unable to Assign to an added Data Column

Good Evening,
I’ve added columns to my data table but can’t seem to assign values to the newly created columns.

image

The error message I receive is:
Assign Get Name: Exception has been thrown by the target of an invocation.

This is easily resolved if I already have the columns pre-made and available instead of using add data column activity.

Logic:
Add newdatacolumn -
For each row in my datatable
Assign newdatacolumn = name;
image

image

Am I doing something wrong?

@emrabino

Can you show me where you are writing in Assign?
Also, you are using Regex, So check if this is not null

For your reference check below
Reference

Hope this may help you

Thanks

Good Evening thank you for answering,

I’m writing to my newly created column:
image

image

I’ve checked my regex output; it has value

@emrabino

Okay instead can you check the reference I posted?
You have to create the columns before the for each

Hope this may help you

Thanks

Yes! I do have them before the for each activity,

It’s rather weird why the platform is behaving this way despite the flow.

@emrabino

Try this way

First declare a Index variable in properties of For Each

Now Inside Assign write as
dt.Rows(IndexVariable).Item(“Name”) = Your Value

Hope this may help you

Thanks

Good Evening,
sorry for the late response,

Still the same issue, i’ll try this with a different version of UiPath Studio tomorrow. I’m hoping it’s just a fluke as the logic is correct

@emrabino

If possible can you share your workflow folder
So, that I will check and let you know

Thanks

Thank you so much,

It’s just a basic test workflow

SplitString.xaml (10.6 KB)

Thanks!

@emrabino

I need entire workflow folder with the input file

Thanks

Oh! I’m not using an input file.

I’m just using a “build data table” activity to test the logic.
And the workflow is just that singular file :<

@emrabino

I see why the error is triggering

Just remove the Auto increment in the columns you are creating

Hope this may help you

Thanks

@emrabino

Can you please convert DataTable dt using string using Output DataTable activity and print it before For Each Row activity and check whether new columns added to DataTable or not.

Sorry for the late revert,
Build Data Table
image

Add Column:


image

Output
image
image

Hi @emrabino could you please show the regex also?

Thanks

Sure!

Get Name regex:
dt.Rows(IndexVariable).Item(“Name”) = System.Text.RegularExpressions.Regex.Replace(CurrentRow(“Date, Name”).ToString,"(\d{2}|\d{1}) [A-z]{3} \d{2,4}","")

Get Date regex:
dt.Rows(IndexVariable).Item(“Date Applied”) = System.Text.RegularExpressions.Regex.Match(CurrentRow(“Date, Name”).ToString,"(\d{2}|\d{1}) [A-z]{3} \d{2,4}").ToString

This has been solved:

I just deleted the Add Column activity and it resolved itself without issue.
image

Thank you everyone for your assistance!