I want to find today date count in each rows once found today date in anyone row then check the count of today date if today date count is 4 then skip that row , if today date count is less then 4 like count 1 or 2 or 3 then pick the first index value in particular row then print the log message and update Today date to last index of row in particular row.
Should update one row only based on input “L1” column, If i give input YYY check max count of 4 today date, if present then skip that row, else update today date, based upon the input first column.
if XXX i give input means check max count of today date if less than 4 today date then update today date .
(From row In dt.AsEnumerable
Let a = System.Text.RegularExpressions.Regex.Matches(String.Join(",",row.ItemArray),"\b\d{2}\.\d{2}\.\d{2}\b").ToList()
Let b = a.Where(Function(x) x.ToString.Equals(Now.ToString("MM.dd.yy"))).ToList().Count=4
Let c = If(b,String.Join(",",row.ItemArray).Split(CChar(",")),(String.Join(",",(String.Join(",",row.ItemArray)).Split(",",StringSplitOptions.RemoveEmptyEntries))+",Output "+Now.ToString("MM.dd.yy")).Split(CChar(",")))
Select dt.Clone.Rows.Add(c)).CopyToDataTable
Thanks, This is not static table , You mention Add data column in “L9”, Where ever occur in today date based upon input name that particular row only should update.
Based on first column(“L1”), If i give XXX that row only should process check max count 4 if 4 than should skip else update that row.
(From row In dt.AsEnumerable
Let a = System.Text.RegularExpressions.Regex.Matches(String.Join(",",row.ItemArray),"\b\d{2}\.\d{2}\.\d{2}\b").ToList()
Let b = a.Where(Function(x) x.ToString.Equals(Now.ToString("MM.dd.yy"))).ToList().Count=4
Let c = If(b,String.Join(",",row.ItemArray).Split(CChar(",")),(String.Join(",",(String.Join(",",row.ItemArray)).Split(",",StringSplitOptions.RemoveEmptyEntries))+",Output "+Now.ToString("MM.dd.yy")).Split(CChar(",")))
Let d = If(row.ItemArray(0).ToString.Equals(stKey),c,row.ItemArray)
Select dt.Clone.Rows.Add(d)).CopyToDataTable
before i was taken via Index based, now i used column name change the ‘d’ value below
(From row In dt.AsEnumerable
Let a = System.Text.RegularExpressions.Regex.Matches(String.Join(",",row.ItemArray),"\b\d{2}\.\d{2}\.\d{2}\b").ToList()
Let b = a.Where(Function(x) x.ToString.Equals(Now.ToString("MM.dd.yy"))).ToList().Count=4
Let c = If(b,String.Join(",",row.ItemArray).Split(CChar(",")),(String.Join(",",(String.Join(",",row.ItemArray)).Split(",",StringSplitOptions.RemoveEmptyEntries))+",Output "+Now.ToString("MM.dd.yy")).Split(CChar(",")))
Let d = If(row("L1").ToString.Equals(stKey),c,row.ItemArray)
Select dt.Clone.Rows.Add(d)).CopyToDataTable
Main.xaml: Compiler error(s) encountered processing expression “(From row In dt_data.AsEnumerable
Let a = System.Text.RegularExpressions.Regex.Matches(String.Join(”,“,row.ItemArray),”\b\d{2}.\d{2}.\d{2}\b").ToList()
Let b = a.Where(Function(x) x.ToString.Equals(Now.ToString(“MM.dd.yy”))).ToList().Count=4
Let c = If(b,String.Join(“,”,row.ItemArray).Split(CChar(“,”)),(String.Join(“,”,(String.Join(“,”,row.ItemArray)).Split(“,”,StringSplitOptions.RemoveEmptyEntries))+“,Output “+Now.ToString(“MM.dd.yy”)).Split(CChar(”,”)))
Let d = If(row(“L1”).ToString.Equals(stKey),c,row.ItemArray)
Select dt_data.Clone.Rows.Add(d)).CopyToDataTable".
‘ToList’ is not a member of ‘System.Text.RegularExpressions.MatchCollection’.
@Raja.G
we would recommend to start with essential / hybrid LINQ approach to do a first prototype:
Find below some starter help for the main building blocks
For each activity: set typeargument to DataRow -
item in dtData.AsEnumerable.Where(Function (x) x("L1").toString.Trim.Equals(YourFilterStringVar))
we can do on string base:
item.ItemArray.Skip(1).Where(Function (x) x.toString.Contains(“YourDateStringVar”)).Count
(From row In dt_data.AsEnumerable
Let a = String.Join(",",System.Text.RegularExpressions.Regex.Matches(String.Join(",",row.ItemArray),"\b\d{2}\.\d{2}\.\d{2}\b")).Split(CChar(",")).ToList
Let b = String.Join(",",a.Where(Function(x) x.ToString.Equals(Now.ToString("MM.dd.yy")))).ToList().Count=4
Let c = ((String.Join(",",row.ItemArray)).Split(",".ToCharArray,StringSplitOptions.RemoveEmptyEntries)).toarray()
Let d = If(row("L1").ToString.Equals(str_Name),c,row.ItemArray)
Select dt_data.Clone.Rows.Add(c)).CopyToDataTable