111962
(YU.)
January 28, 2022, 6:57am
1
Hi, guys.
When I tried to update column’s value in a datatable by using LINQ as below.
but I got this error, any advice to solve this.
error message:
WorkProcess.xaml: Method not found: ‘Microsoft.CodeAnalysis.SyntaxTree Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxTree.ParseText(System.String, Microsoft.CodeAnalysis.VisualBasic.VisualBasicParseOptions, System.String, System.Text.Encoding, System.Collections.Immutable.ImmutableDictionary`2<System.String,Microsoft.CodeAnalysis.ReportDiagnostic>, System.Threading.CancellationToken)’.
Thank you!
ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー
and I tried this method also. still got an error.
1 Like
Hi
Have a view on this expression
dt = (From r In dt.AsEnumerable
Select ia = r.ItemArray.toList
Select ic = ia.ConvertAll(Function (e) e.ToString.Trim.Replace(“old word”,“your new word”)).toArray()
Select dtCorrected.Rows.Add(ic)).CopyToDataTable()
Cheers @111962
2 Likes
111962
(YU.)
January 28, 2022, 7:15am
3
@Palaniyappan
Thank you for your quick reply.
I want to update all of column(“columnname”)'s value.
how can I refer to specific column?
1 Like
Hi @111962 ,
Can you tell us the exact usecase so that we can provide you a query for that.
Thanks
1 Like
Hey @111962
Updated below.
dt = (From r In dt.AsEnumerable
Select ia = r.ItemArray.toList
Select ic = ia.ConvertAll(Function (e, index) if(dt.Columns(index).ColumnName.Equals("ColName"), e.ToString.Trim.Replace(“old word”,“your new word”), e).toArray()
Select dtCorrected.Rows.Add(ic)).CopyToDataTable()
Hope this helps
Thanks
#nK
1 Like
111962
(YU.)
January 28, 2022, 7:23am
6
I’m so sorry for that I didn’t explian that clearly.
I have a datatable(Dt_PJMaster), I want to update column (“工事名1”)
I want to replace all the “,” values in the( “工事名1”) column with “、”.
Have a view on this thread with similar scenario
@JoshLoops
Sorry. I forgot to mention one point here.
You need to write expression in Invoke Code activity.
dt_InvoiceNames.AsEnumerable().ToList().ForEach(Sub(row) row(“Issue”) = “Invalid”)
Note: Create one argument for Invoke Code activity and mention properties as below.
Name - dt_InvoiceNames
Direction - In
Type - DataTable
Value - dt_InvoiceNames
@111962
Yoichi
(Yoichi)
January 28, 2022, 7:26am
8
Hi,
The following post will help you regard of the exception in Invoke Code activity.
@Shilpa_Mohanty @prasath_S @StefanSchnell
Hi,
I can just reproduce this problem in my environment as the following.
[img20211206-2]
I haven’t get the exact conditions for reproduction yet, but In Studio 20.10.9 with System.Activities package 21.10.2 this occurs. If downgrade System.Activities package to 20.10.4 (this is bundled version of Studio 20.10.9) , there is no error.
So for now can you try to downgrade System.Activities package to 20.10.4, if you use Studio except the latest.
Rega…
Regards,
1 Like
111962
(YU.)
January 28, 2022, 7:35am
9
Thank you for your advice.
I tried this method, but I still can’t get rid of this error.
1 Like
Hey @111962
I hope you have created the dt variables as args for invoke code?
Thanks
#nK
111962
(YU.)
January 28, 2022, 7:38am
11
I have imported this datatable argument for invoke code as belows.
1 Like
DtCorrected is also a new datatable that as well please.
Thanks
#nK
1 Like
Yoichi
(Yoichi)
January 28, 2022, 7:41am
13
Hi,
Can you try to downgrade to System.Activities package 20.10.x as refereed post in my previous post?
This matter is not the expression but InvokeCode activity itself.
Regards,
111962
(YU.)
January 28, 2022, 8:00am
14
thank you for your reply.
I tried to downgrade the package( System.[Activities] package 20.10.x, but I got a lot of errors. and too many missing and invalid activities.
is there any other solution to this problem.
111962
(YU.)
January 28, 2022, 8:10am
15
The Dt_PJMaster (DataTable) is defined in the xaml file, as shown in the screen scribe importing the above arguments.
Yoichi
(Yoichi)
January 28, 2022, 8:45am
16
Hi,
If you can share your datatable structure (column names), I might be able to provide you with expression using LoadDataRow method.
Or
Can you try to update the latest preview version (21.12.0preview) if you use stable version.
Regards,
1 Like
111962
(YU.)
January 28, 2022, 8:55am
17
Thank you very much.
my datatableis like this.
I was tring to replace all the value “,” with “、” in column(工事コード).
Yoichi
(Yoichi)
January 28, 2022, 9:14am
18
Hi,
Can you try the following expression using Assign activity?
dt = dt.AsEnumerable.Select(Function(r) dt.Clone.LoadDataRow({r(0),r(1).ToString.Replace(",","、"),r(2),r(3),r(4),r(5),r(6)},False)).CopyToDataTable()
Please replace index number to column name for readability, if the above works.
Regards,
2 Likes
111962
(YU.)
January 28, 2022, 9:32am
19
Thank you very much for all your advice.
However, I still can’t get rid of the error ,I will try to find another way to solve it.
Thank you very much.
Yoichi
(Yoichi)
January 28, 2022, 9:32am
20
Hi,
Please use it in Assign activity.
Regards,
1 Like