I have an array of certain words, and I want to cross reference those with a pdf and check if any of the elements in my array are present in the pdf. I tried using a for loop that basically says
for currentItem in array:
if pdf.contains(currentitem) == True :
I keep getting an "Overload resolution failed because no accessible contains can be called with these arguments"
Can someone help with this
ensure that the array goodplan is of datatype String Array / List(Of String)
the typeargument of the for each activity is set to String
thanks. Error on my part
looks like it is solved and the topic can be closed by:
not quite. My validation still returns “failed”.
debug it and check on which looped item it fails also feel free to set breakpoints and inspect more in detail with one of the debugging panels:
what is the error now?
What is the variable type for plandescrip and goodplan (Can you please post a screenshot of the variable panel)
I have a for loop that goes through every element in the array and checks if any of them are in plan descrip, they all return false.
Don’t forget to check the letters case (uppercase lowercase ) .
the array table was created from the description I’m looking through. It should be the exact same thing
Hi @cemenike ,
Could you also let us know if it is just a Check that you are trying to perform ? Or are there operations
Within the Loop that you do after Success or False.
We can have a check for the condition mentioned with the below Expression directly without the
For Each Loop activity :
The above Expression would return
True if any one of the Element is present in the
Also, A Clear understanding of the variables
planedescrip variables would help us to analyse faster and provide you with accurate suggestions.
Note: You were looping through
goodplan which is a string, so each character in the string is returned as the item.
It is just a simple success or failure checker. If the text is in plan descrip, print success
for more clarity, goodplan is a txt file containing a list of strings that I converted to an array (array1) where each element is a line of string content
plandescrip is a variable that i assigned to a pdf.
the text content that I am looking is 100% in goodplan, but everytime i run the .contains(array(correct index)) function, i get a false return
I have tried running a .contains() using a string instead of a variable and this sort of worked. But i need it to loop through that array and tell me when it spots the one that is correct. as i have a lot of pdfs to go through
If looping through is what is needed then could you maybe provide a Screenshot of the implementation done as we do not see the looping of PDF files.
Motive is to correct your designed flow as little as possible, identifying the corrections to be done or better methods in it’s place.
Also, Maybe confirm on the Expression provided above if it works ?
expression didnt work.
For clearer context
This is the pdf text I’m trying to grab
One of the array’s elements is this exact text word for word, case sensitivity included.
all i just want is for when the pdf is passed through, the array element that has this string, comes up and returns true in my contains function. i have my array saved as the write data type. I just dont know why it doesnt see it
I even tried to write out the text in the contains() instead of using an array element just in case, the boolean still returns false
Assuming this is the representation in PDF document, did you check the data after writing to a Text file ?
Since it is a long line check, need to also check how the data is extracted from the PDF and how it is presented after extraction.
From the Text data shown it looks like there are new lines involved with the data that you want to check.
So, Maybe trying to replace the
NewLine with a Space could help your scenario :
So instead of
planedescrip use the above Expression to check with the
Write Line activity as you have already done using
Also, try writing the above Expression into the Text file and check the format presented in it.
that solves the issue. Thank you very much