Datatable doubt

In the entire excel how can i remove that symbol

in that linq query itself you can use it filtereddt.AsEnumerable().Min(Function(row) Cint(row(“Price”).toString.Replace(“,”,“”).Replace(“$”,“”)))

it is still showing the same error

we cannot convert empy values / blank but can filter out

give a try at:

(From d in filtereddt.AsEnumerable()
Where Not (isNothing(d("Price")) OrElse String.IsNullOrEmpty(d("Price").toString.Trim))
Select x= Cint(row("Price").toString.Trim)).Min(Function (x) x)

Also we can decide for other strategies like:

  • using the Int32.TryParse() method
  • ordering the values and taking first / last for min and max

How can i assign this,can u elaborate

Assign Activity
LHS: myMin | DataType: int32
RHS:

(From d in filtereddt.AsEnumerable()
Where Not (isNothing(d("Price")) OrElse String.IsNullOrEmpty(d("Price").toString.Trim))
Select x= Cint(row("Price").toString.Trim)).Min(Function (x) x)

what is d i am not good at vb.net thats why i ask

it is like a local variable referencing the looped datarow within the LINQ

it looks fine when i remove the null values but i have to filter that price and write it into new excel sheet i filter using filter datatable but shows no values how it can be rectified

Can you show the filter condition?


by extracting the smallest price it shows 16999 instead of 16,999 i think that the problem

do u got it

Try
Convert.ToDecimal(cheapest).ToString(“#,##0”) to convert it to original format and then do the filter operation. I think you need to add $ as well in the beginning

in the filterdata table?

yes…in the value section try to give “$”+Convert.ToDecimal(cheapest).ToString(“#,##0”) as value

thank u so much by the by why we use # and ##0

this is used to convert it to number format with “,”

##0 means what

Understanding Number Formatting Codes (Microsoft Excel) check this

1 Like

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