Removal of Trailing Spaces from Datatable


I want a LINQ to remove all the trailing spaces from the Data-Table…

Currently, when I am uploading it to the Orchestrator I am getting trash data such as:

I am getting the \u00a0 from the Orchestrator as well even though the excel has blank spaces…

1 Like

hope you are doing good
May i know how it looks in datatable may be a screenshot if possible
use a output datatable and writeline so that we can see that in the output panel

Cheers @Shubham_Varshney

Hi @Palaniyappan

I am doing good, what about you mate

Let me pull that up real quick and share it back with you :slight_smile:

1 Like

Orchestrator Data:


In Output panel

Kinda confused how the scrap data is getting added :expressionless:

Can any one please help me with this issue :frowning:
@Palaniyappan @lakshman @ppr @Lahiru.Fernando

I willl have a closer Look, once my train is departed and have found a seat

a correction conversion into a dict via linq Could be an approach for each row returned as a dictlist. Maybe each dict can later be used directly for the add Queue item info

This will take time… I am avoiding delay in this as I am using bulk upload :frowning:

We will need some thing i.e. LINQ that would get me with removal of blank spaces :expressionless: :frowning:

dt2 = dt.Clone,
LINQ Correction with Object() for each row returning list (Of Object())
ForEach over list
and add each Object() to dt2

would this be an option? (I would prefer to not to doit as Oneliner)

1 Like

Can you please elaborate on the same kinda confused with the LINQ stuff?

I do some RnD, but currently got lost with my train - so maybe i will be interrupted or get many hours extra :slight_smile:

The Main Idea was following:

From r In dtData.AsEnumerable
Select ia = r.ItemArray.toList
Select ia.ConvertAll(Function (e) e.ToString.Trim).toArray

“silly Text”
“I dont like Spaces”,

And with my silly trick from the past (hope you remember)

Assign: dtCorrected = yourDTVar.Clone

Assign: dtCorrected

(From r In dtData.AsEnumerable
Select ia = r.ItemArray.toList
Select ic = ia.ConvertAll(Function (e) e.ToString.Trim).toArray()
Select dtCorrected.Rows.Add(ic)).CopyToDataTable()

is doing:
text,silly Text
I dont like Spaces,Why?

Here is the demo xaml: Shubham_SpaceCorrector.xaml (8.9 KB)

1 Like

Thanks a lot @ppr!!!

It worked like wonder and helped me out :smiley:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.