I’m quite new in RPA and in UIPath and I’d like to ask for a bit of help.
I have a project in which I read an excel file of keywords (some of them may contain spaces and some of them don’t) and save it to a datatable.
Later on in the workflow I scrape a full text, and I would like to find above mentioned keywords within the text, so it should search for one row in the text, if it’s not present in the text jump to the next row, if the keyword is found in the text it should break the cycle.
Could anyone help me out in this one?
If you have a block of text you can split by linebreak by calling String.Split(text.Replace(chr(10), “”), chr(13)). Then you can foreach over the array and inside that see if any row contains the words in the datatable.
The reason why we replace chr(10) with an empty string is because a linebreak is “Carriage Return + Line Break”. One char is the first, the second the other. Therefore we remove it to have “clean lines”.
I might have not completly gave clear information.
So I scrape the full text of a PDF. Which can contain 200+ rows of information.
This full text which is varying needs to be checked if it contains any of the keywords of an excel file.
I would loop through the excel keywords in a foreach and in every instance you can check via PDFFullText.contains(“xxxKeyWordwxxx”). This will give you a boolean as result
Yes, that’s what I’m trying to do.
So far I have an excel application scope with a Read Range activity that creates a DTkeywords datatable.
After that comes the for each row in dtkeywords, with an IF condition of fulltext.Contains(dtkeywords) then it should show me a message box with the message like “found it” and on the else part “didn’t find it”.
This is the process I’m having in my mind but the IF condition part is where I’m having the issue and can’t figure out how to get each row of the datatable to be checked in the fulltext.
If this makes sense at all.
You need two for each if there are keywords both in the rows and columns of the datatable. To iterate over the rows of a datatable, do a foreach over datatable.Rows, and to iterate over each element of a row do a foreach over row.ItemArray.
Thanks a lot @Anjali01.
It did help me to work it out.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.