I am reading excel sheet and excel row data length can be more than 10 digits in any columns. if digits length is more than 10 in length than take only 10 digits from starting of the data . Please help me to provide linq query to resolve that issue.
Dim d As Decimal
Dim e As Int32
dt.AsEnumerable.ToList.ForEach(Sub(r)
dt.Columns.Cast(Of DataColumn).ToList.ForEach( Sub(c)
If (Decimal.TryParse(r(c).ToString,d) AndAlso d<>0) Then
e =CInt(Math.Floor(Math.Log10(Math.Abs(d))))
r(c)=Math.Round(d/(Math.Pow(10,e)),9,MidpointRounding.AwayFromZero)*Math.Pow(10,e)
End If
End Sub
)
End Sub
)
Thank you very much for your help. Result is looks very perfect but the issue is BOT also removing the digits if it is not more than 10 digits in length. Please check the screenshot with BOT text result and manual text result. So you can know more about it.
Please help to resolve that issue.
Dim d As Decimal
Dim e As Int32
dt.AsEnumerable.ToList.ForEach(Sub(r)
dt.Columns.Cast(Of DataColumn).ToList.ForEach( Sub(c)
If (Decimal.TryParse(r(c).ToString,d) AndAlso d<>0 AndAlso d.ToString.Length>10) Then
e =CInt(Math.Floor(Math.Log10(Math.Abs(d))))
r(c)=Math.Round(d/(Math.Pow(10,e)),9,MidpointRounding.AwayFromZero)*Math.Pow(10,e)
End If
End Sub
)
End Sub
)