Remove "=" from a row

I have an excel which contains some data
If data starts with “=” Or "=="remove only "="or "=="and rest let remain the data as it is.
Please find the sheet attached.
Testingsheet.xlsx (9.1 KB)
How can we do this??

Read range

For each row in datatable

if current item starts with “=” or “==” remove it and continue

Regards,

Hi @B_H_Akshatha_Pai
I just have to remove “=“or”==” and let rest of the data remain the same.

Hi

Hope the below steps would help you resolve this

  1. Use a READ RANGE workbook activity and get the output as datatable named dt

  2. Now use a assign activity like this

dt_final = dt.Clone()

Where dt_final is a datatable type variable

  1. Now use a assign activity like this

dt_final = (From r In dt.AsEnumerable
let ra = r.ItemArray.Select(Function (x) x.ToString.Trim.Replace(“=”,“”)).toArray()
Select dt_final.Rows.Add(ra)).CopyToDataTable()

Cheers @Kunal_Jain

Hi @Kunal_Jain

Try with this expression in Assign actuivity

Dt.AsEnumerable().Select(Function(a) Dt.Clone.LoadDataRow({a.Field(OF String)("column name").ToString.Replace("=","")},False)).CopyToDataTable

Regards
Gokul

Hi @Palaniyappan
It is removing all the “=” that is if the "="is present in middle also than also the code is removing it.
I just need to remove “=” where it in starting.
If you will check excel than in that the data present is
=move out declined SM8/28
req mov out 9/14 SM8/18
We have to remove "="from this.
But from this
<img =src"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAqUAAABDCAYAAAClWnyEAAAgAElEQVR4Ae1dPbLcOA7WcRw4ctgnmHDizafTucGWLzBVL59g8oldnW/iSzjxTbhFkBABEITUalt""/>
We don’t have to remove.
Can we do that??
I have updated the excel with the example.
Testingsheet.xlsx (9.2 KB)

1 Like

Fun if you want to remove only the symbols which are the starting then the expression would be like this

dt_final = (From r In dt.AsEnumerable
let ra = r.ItemArray.Select(Function (x) x.ToString.TrimStart(“=”c)).toArray()
Select dt_final.Rows.Add(ra)).CopyToDataTable()

Here we are using TrimStart instead of Replace that will remove only the starting symbol

Cheers @Kunal_Jain

Hi @Palaniyappan
Do I need to use any If condition if equals is not present or directly use this code.
Because I have to check both the scenarios.
If “=” is present or not
Thanks in advance!!

1 Like

Not required @Kunal_Jain
It will remove if it’s there if not it will still leave and proceed further

Hope it’s clarified
@Kunal_Jain

Hi @Palaniyappan
Yes it is resolved
Thanks!!

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