Again, my apologies for simple questions, but I am new and trying to learn.
I am trying to manipulate some data that is currently within a datatable.
The data that I am trying to manipulate has leading spaces and ending spaces.
In my mind, I thought that the trim function would work, but I am struggling to get the function to work.
I can use the trim function in a messagebox
trim(CurrentRow(“Name”).ToString) + trim(CurrentRow(“Number”).ToString)
However, I can’t get the trim to work on the “Add Data Row”, in fact it won’t let me type the word trim anywhere.
I am sure htis is a simple question, but i am just trying to learn
ppr
(Peter Preuss)
February 23, 2022, 2:06pm
2
give a try on
{CurrentRow("Name").toString.Trim, CurrentRow("Number").toString.Trim}
Gokul001
(Gokul Balaji)
February 23, 2022, 2:20pm
3
Hi @daryl_pressley
You can also use this method
Use Assign activity
LHS → Create an Variable
RHS → Currentrow(“Column Name”).Tostring.Trim
Use Add data Row Activity
Pass the variable in the [ArrayRow]
Regards
Gokul
1 Like
@ gukul001
i am getting the following error message
Does this mean i need to set a value somewhere for dt?
If so what vaue and where?
Gokul001
(Gokul Balaji)
February 23, 2022, 2:47pm
5
Can you scare the error message and screenshot of the workflow @daryl_pressley
Here is a screenshot of workflow and error message
Do you need the entire workflow?
ppr
(Peter Preuss)
February 23, 2022, 2:52pm
7
dt is not properly initialized, is it?
Gokul001
(Gokul Balaji)
February 23, 2022, 2:53pm
8
Can you check the Data Table is not set correct @daryl_pressley , Share the workflow and input file if possible
How do i initialize it? Again, I am a newby. Sorry for stupid question
I can’t share files on here, I am still new i guess, the forum won’t allow me to yet
ppr
(Peter Preuss)
February 23, 2022, 2:56pm
11
you can use the Build datatable Activity,
ensure an empty datatable is generated - dt
then use it as done in your screenshots
ppr
(Peter Preuss)
February 23, 2022, 2:57pm
12
daryl_pressley:
I am a newby.
here we also recommend: UiPath Academy
Hi @daryl_pressley ,
While using the Add Data Row Activity
, make sure you have the Datatable ready, We can use an Existing Datatable which follows the Number of Values that you assign to the Array Row Property with it’s number of Columns.
or We can define the datatable using the Build Datatable Activity
with two Columns of the Datatypes you require.
Gokul001
(Gokul Balaji)
February 23, 2022, 2:58pm
15
Can you check the dt that you have assigned in the Add data row activity.
May be the excel file contains the empty values @daryl_pressley
Gokul001
(Gokul Balaji)
February 23, 2022, 3:01pm
16
Here is the sample workflow for you reference @daryl_pressley
Sequence1.xaml (17.4 KB)
Regards
Gokul
ppr
(Peter Preuss)
February 23, 2022, 3:02pm
17
daryl_pressley:
nput file pic
looks like you want to trim the existing values and write them back to the same data table. In such case we would use a
For each row in datatable
assign: CurrentRow(“Name”) = CurrentRow(“Name”).toString.Trim
same for Number
I tried the sequence you sent, but i am getting following error message
Hi @daryl_pressley ,
Looking the error I am assuming you are working on the same DT and also modifying the same DT as well. Is it ??
Thanks