ammohan
(Ammohan)
December 12, 2022, 9:02am
1
Hi everyone,
My requirement is to remove everything after the occurrence of the first comma in an entire column of a datatable. Please find the input and expected output below. My data table is huge and hence I cannot use for each loop. Please provide a code to do the same.
Thanks
Hello @ammohan
You can use Read Range to read the excel and then use Output datatable to convert to string. The use Text to columns or Generate Datatable acitvity.
Thanks
ammohan
(Ammohan)
December 12, 2022, 11:49am
3
Hi Rahul,
I basically want to use invoke code to remove everything characters that come after the first comma for the entire column through an invoke code. The data table I have is huge with 76k records.
Thanks,
Amrutha
@ammohan ,
Please find the below code and use in invoke activity
DT.asenumerable.Tolist.Foreach(Sub(r) r(“Input”)=r(“Input”).tostring.split(","c).first.tostring).Copytodatatable
1 Like
varunk
(Varun Kumar)
December 12, 2022, 12:04pm
5
@ammohan
Use split operation you will get output, Please find the below example
Ex: Input is a variable
Input =“12344, 87907”
Syntax - Input.toString.split(",".ToCharArray)(0)
Using this syntax you will get Output as 12344
Thanks
Varun
ammohan
(Ammohan)
December 13, 2022, 10:33pm
6
Hi @muhamed_fasil
I am getting the following error while using the code in invoke code.
Can you please help me to resolve it?
@ammohan ,
Please provide the datatable variable direction as inOut in the arguments of invoke activity
ammohan
(Ammohan)
December 14, 2022, 12:27pm
8
@muhamed_fasil Yes, I have given it as in/out. But still facing the same issue.
ammohan
(Ammohan)
December 14, 2022, 12:36pm
9
Hi @muhamed_fasil ,
I had to remove the .copytodatatable() part from the code and it worked.
Thanks!
1 Like
system
(system)
Closed
December 17, 2022, 12:36pm
10
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.