emrabino
(Ennie )
September 9, 2021, 10:38am
1
Good Evening,
I’ve added columns to my data table but can’t seem to assign values to the newly created columns.
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;
Am I doing something wrong?
Srini84
(Srinivas Kadamati)
September 9, 2021, 10:43am
2
@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
emrabino
(Ennie )
September 9, 2021, 10:59am
3
Good Evening thank you for answering,
I’m writing to my newly created column:
I’ve checked my regex output; it has value
Srini84
(Srinivas Kadamati)
September 9, 2021, 11:01am
4
emrabino:
my newly created column
@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
emrabino
(Ennie )
September 9, 2021, 11:04am
5
Yes! I do have them before the for each activity,
It’s rather weird why the platform is behaving this way despite the flow.
Srini84
(Srinivas Kadamati)
September 9, 2021, 11:25am
6
@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
emrabino
(Ennie )
September 9, 2021, 12:39pm
7
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
Srini84
(Srinivas Kadamati)
September 9, 2021, 12:43pm
8
@emrabino
If possible can you share your workflow folder
So, that I will check and let you know
Thanks
emrabino
(Ennie )
September 9, 2021, 12:44pm
9
Thank you so much,
It’s just a basic test workflow
SplitString.xaml (10.6 KB)
Thanks!
Srini84
(Srinivas Kadamati)
September 9, 2021, 1:25pm
10
@emrabino
I need entire workflow folder with the input file
Thanks
emrabino
(Ennie )
September 9, 2021, 1:34pm
11
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 :<
Srini84
(Srinivas Kadamati)
September 9, 2021, 1:42pm
12
@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
lakshman
(Ganta lakshman)
September 9, 2021, 1:43pm
13
@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.
emrabino
(Ennie )
September 10, 2021, 1:00am
14
Sorry for the late revert,
Build Data Table
Add Column:
Output
prasath_S
(prasath S)
September 10, 2021, 2:40am
15
Hi @emrabino could you please show the regex also?
Thanks
emrabino
(Ennie )
September 10, 2021, 2:47am
16
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
emrabino
(Ennie )
September 10, 2021, 3:17am
17
This has been solved:
I just deleted the Add Column activity and it resolved itself without issue.
Thank you everyone for your assistance!