Hi I want to sort Excel item based on KG and G in the Item description
Expected output :
what is the best approach for this
any help will be highly appreciated
-Vincent
Hi I want to sort Excel item based on KG and G in the Item description
Expected output :
what is the best approach for this
any help will be highly appreciated
-Vincent
Hi,
Can you try the following sample?
dt = dt.AsEnumerable.OrderByDescending(Function(r) CDbl(System.Text.RegularExpressions.Regex.Match(r("Description").ToString,"[.\d]+(?=\D*$)").Value)).CopyToDataTable
Sample20221215-2.zip (9.5 KB)
Regards,
Hi sorry there’s still need to be fixe
all KG and G should also in descending
the output should be like this
Hi,
How about the following expression?
dt.AsEnumerable.OrderByDescending(Function(r) CDbl(System.Text.RegularExpressions.Regex.Match(r("Description").ToString,"[.\d]+(?=\D*$)").Value)*if(System.Text.RegularExpressions.Regex.IsMatch(r("Description").ToString,"kg$",System.Text.RegularExpressions.RegexOptions.IgnoreCase),1000,1)).CopyToDataTable
Sample20221215-2v2.zip (14.5 KB)
Regards,
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.