I have some questions for you, first i’m using UiPath in C#, and i want to do multiple things using LINQ or Lambda expression, i would like to have both solution for me to understand what i’m doing wrong.
First i want to apply a function and a if condition with a cast on rows of this DT
Type
Number
Letter
XA
999
J
XB
200
J
XC
60
J
XD
3
M
All columns are String, If [Letter] = “m” i Want [Number] = [Number]*30.5
Res :
Type
Number
Letter
XA
999
J
XB
200
J
XC
60
J
XD
91,5
M
Second part is to keep all the rows from a second DT :
ID
Type
Number
1
XA
400
2
XC
70
3
XD
46
that are > to 50% of the [Number] corresponding with [Type]
Res :
ID
Type
Number
2
XC
70
3
XD
46
Doing it with a for each etc is fine but i would like to have in C#, a LINQ query, and a Lambda expression for both operation please
(from d in dtData.AsEnumerable()
let np = Convert.ToDouble(d["Number"].ToString().Trim())
let chk = d["Letter"].ToString().Trim().Equals("M")
let nm = chk ? (np*30.5).ToString() : np.ToString()
let ra = new object[] {d[0], nm, d[2]}
select dtResult.Rows.Add(ra)).CopyToDataTable();