Hello guys i have an excel with data containing
I want to remove only "-A " or “-B” in the last and should remove for any alphabet letter.
note this string length is not constant it may vary
Hello guys i have an excel with data containing
I want to remove only "-A " or “-B” in the last and should remove for any alphabet letter.
note this string length is not constant it may vary
How about this Regular expression?
System.Text.RegularExpressions.Regex.Replace(YourString,"-\w$","").Tostring
Use this code in Invoke code activity
dt.AsEnumerable.ToList.ForEach(Sub(x) x("ColumnName") = system.Text.RegularExpressions.Regex.Replace(x("ColumnName").ToString,"-\w$","").ToString.trim)
Regard
Gokul
Please try this in invoke code after reading data into datatable dt and add a argument to invoke code dt with direction as in/out
dt.AsEnumerable.ToList.ForEach(sub(x) x("ColumNname") = System.Text.RegularExpressions.Regex.Match(x,".*(?=-[A-Z])").Value)
cheers
Hi @Gokul_Murali ,
Use the invoke code activity and keep dt as in/out argument:
dt.AsEnumerable.ToList.ForEach(Sub(x) x("ColumnName") = system.Text.RegularExpressions.Regex.Replace(x("ColumnName").ToString,"-\w$","").trim)
Regards,
A small change which I missed, i gave only x
inside match it should be x("YourColumname").ToString
dt.AsEnumerable.ToList.ForEach(sub(x) x("ColumNname") = System.Text.RegularExpressions.Regex.Match(x("ColumnName").ToString,".*(?=-[A-Z])").Value)
Hope this helps
Cheers
I don’t receive any error
Can you try to update the system package and check it
Regards
Gokul
Hi @Gokul_Murali ,
In this workflow, you are passing a wrong variable as argument inside the Invoke Code
activity.
I believe it should be dt
and not data1
.
Thankyou so much
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.