Excel Filter Data

So I have a table having quite a few values in that I have one column named

XYZ which has some values starting from Zero like

401514 25
000123 006
000124 006
046800520
08949180
0480140012

When you apply filter data using ienumerable or anything the value gets updated and the zero at the front gets removed

Please advise any further improvements I can make into my projects so that it wont cause any issues I need zero as shown above.

One more question how do we filter values using filter data table it always shows no change when you use it on a table that has some values like

I need “Phones” greater than 250 how to put it up in filter so that it actually shows phones which have price greater than 250.

TIA

Hi @Rahul_Singh_Kamboj ,

Does the Datatable Preserve the O’s at the Initial Stage, i.e after we read using Read Range Activity ? And only After Filtering Datatable does the 0 values at the beginning disappear ?

Yes…

there is one more question regarding filtering data table please have a glance over that too in the same question above

@Rahul_Singh_Kamboj , The Reason for this would be that the Data Type of the Columns of the Datatable when read using Read Range Activity would be an Object Type.

When Comparing Numerical values, it might not give you a Proper output due to it.

You can Either Convert the Column to an Integer, i.e create an Integer Column and Populate it with the values, then Perform Comparison

else

We can use the Linq Approach to Filter the values as it has more control over the data that we want to use.

@Rahul_Singh_Kamboj ,
Could you provide us the Expression that you were using to Filter the Values ? We may be able to modify it to get the Output as needed.

The filter we are applying is for different column but when a new sheet is being created by this linq query the data in column with 0 values get removed and what is left is values without 0

for e:g
046800520 = 46800520
08949180 = 8949180
0480140012 = 0480140012

ZVAA_ExcelData.AsEnumerable.Where(Function(x1) Convert.ToString( x1(“Plant”)).Contains(“WIS2”) And Convert.ToDouble(x1(“Net Value”))>250.00 ).CopyToDataTable

@Rahul_Singh_Kamboj , Before Moving Further, Can we confirm that the Datatable right after reading from Excel, will have the Zero’s still prepended to it ?

We can do this using Debug, Add a Break Point after Read Range Activity and Click on Debug.

In the Immediate Panel, Check the Datatable value.

@Rahul_Singh_Kamboj , Apologies.

System got Shut down due to low battery.

1 Like

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