I need to know a regular expression or a code that can help to find me the condition where failed records number must be greater than 0
Here I have attached the excel file for the records
invoice3.xlsx (8.5 KB)
Please help me out with these
Hi @Kunal_Jain ,
Could you explain a bit more in detail as to what needs to be done ?
Do you want to extract the Failed record numbers count as shown in the image below ? :
Hi, @Kunal_Jain
You can use for each row in excel and extract “Failed Records 1” as a string varible as FailedString
Then use following regex to extract number : CInt(System.Text.RegularExpressions.Regex.Match(FailedString,“[\d]+”).ToString)
Then use if condition to check if failed records count is more than 0.
Thanks and regard,
Dibyaprakash
You can mark this as solution if this is resolving your issue, so that others can get help form this.
But the Failed record data will be at the last of every file and I just need a check to know that if failed record count is more than 0 than write a message as failed record otherwise success
Hi @supermanPunch
I just need an expression to extract that if the failed record count is more than 0 than write line as failed record is present otherwise write line as all records are success
@DIBYAPRAKASH_PRADHAN
At last there is Failed Record count
There is a record count
I just need a code to find that if Failed record count is more than 0 than I need a message
Check with the below Expression :
Cint(DT.AsEnumerable.Where(Function(x)x(0).ToString.Contains("Failed Records")).Select(Function(x)Regex.Match(x(0).ToString,"(?<=Failed Records.*)\d+",RegexOptions.IgnoreCase).Value).First)
Here, DT
is the datatable of the Input Excel, we fetch the Column 0 (First Column) values find Failed Records
keywords then extract the number using Regex.
The assumption is that always the Failed Records Count will be present in that format in the First Column.
Let us know if this doesn’t work.
You can check out the following code :
ExcelFailCount.zip (2.0 KB)
If this one resolves your issue then mark it as solution.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.