i have this data input and range 0-10 ,11-20 etc i need to get the level from that
input.xlsx (8.4 KB)
if a have a value 5 then level to come as 2
if 25 then level 5
i have this data input and range 0-10 ,11-20 etc i need to get the level from that
input.xlsx (8.4 KB)
if a have a value 5 then level to come as 2
if 25 then level 5
HI,
Can you try the following sample?
result = dt.AsEnumerable.Where(Function(r) CInt(System.Text.RegularExpressions.Regex.Match(r("Gross").ToString,"^\d+").Value)<= varInput AndAlso CInt(System.Text.RegularExpressions.Regex.Match(r("Gross").ToString,"\d+$").Value)>= varInput).Select(Function(r) r("level").ToString).FirstOrDefault()
Sample20230224-4L.zip (9.3 KB)
Regards,
@Yoichi what if last row we dont have max limit that 40-50 then 51-
so if any value that is above 51- there is value against it
HI,
Can you try the following expression?
result = dt.AsEnumerable.Where(Function(r) if(System.Text.RegularExpressions.Regex.IsMatch(r("Gross").ToString,"^\d"),CInt(System.Text.RegularExpressions.Regex.Match(r("Gross").ToString,"^\d+").Value),Int32.MinValue)<= varInput AndAlso if(System.Text.RegularExpressions.Regex.IsMatch(r("Gross").ToString,"\d$"),CInt(System.Text.RegularExpressions.Regex.Match(r("Gross").ToString,"\d+$").Value),Int32.MaxValue)>= varInput).Select(Function(r) r("level").ToString).FirstOrDefault()
Sample20230224-4Lv2.zip (9.3 KB)
Regards,
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.