I need to return the row that my SampleString contains the row description. I am looking for an efficient solution. My current solution is taking so much time.
SampleString=“Refund requested from the customer. Return because of double charge id=44987. This has been completed. Total amount was $90.10. Task ID: 1124. Completed on 22/04/2023”
DataTable
Column 1
Column 2
Column 3
Column 4
ID
Description
Amount
59025
Payment for service id=59025
$10.10
87250
Payment for grocery id=87250
$20.10
14653
Payment for meat id=14653
$30.10
56698
Payment for table id=56698
$40.10
68938
Payment for cleaning products id=68938
$50.10
87627
Made payment for clothing id=87627
$60.10
62685
Made payment for tablet id=62685
$70.10
28107
Return an item from the previous purchase id=28107
$80.10
44987
Return because of double charge id=44987
$90.10
46900
Payment for rent id
$100.10
48552
Payment for travel id=48552
$110.10
My sample string has more information. Based on the full information, I need to find the correct row.
Description can vary greatly and there are a lot of rows that don’t have id. So, I need to compare description.
Note: I cannot use the for each row activity due to thousands of rows. This is taking huge amount of time because of the thousands of items in the data table. Please help me find efficient solution.
Assign activity:
wordFound = yourDataTable.AsEnumerable().Any(Function(row) row.Field(Of String)(“YourColumnName”).Contains(“return because of double charge id”)).
here you can replace with your data table name and column name , any how the id number is getting different you need to know whether this particular word is available in the column or not.
why i choose vice versa means, you are sample string is not default one, also we are not sure about the id in sample string its keep on changing so but the text is unique one so i write the code for vice versa. Based on the finding value you can get the currentrow(Column1,3,4 values). My requirement to scrap these three values where my sample string match.