Help with the Assign activity

Hi , I am trying to search a word in the extracted information from pdf which is stored in variable ‘j’. However, in the assign, k = j.toString and text1 = k.Substring(“h-CLOUD NO S12345-AB”). There is a validation error 'option strict on disallows implicit conversions from string to integer for the k.substring… I cannot change ‘j’ variable’s type argument to string as after extracting from pdf it has numbers and characters. How can i overcome this validation error?

Thank you xoxo

Variable type for text1, j and k should be string. I guess one of that is integer. Mostly text1.
Can you check?

Hi Sanga,

I’m not sure what your code looks like, but to me it looks like you need to understand what parameters .Substring() takes in. Substring takes in the starting index as an integer, so for example, you need to fix your code as such: text1 = k.Substring(5). Change the number 5 to the target index.

@pathLessTaken Oh i see, As actually I wanted to search for a particular word in a very big text document. And someone suggested i could use the string functions to help. Is there any ways to search for a particular text?

If that is the case, k.Contains(“h-CLOUD NO S12345-AB”) might be what you are looking for. However, .Contains doesn’t return the word you are looking for. It returns a Boolean value of True if the large String text contains the target text.

Yes, I have tried the contain function. However, I dont want the boolean value. I want the text. Is it possible?

Can you share the entire text and the text you are planning to extract from it?

Hi, I send you my project. Right now I used the contains parameter and it returns the boolean value. But i want to search for a text and return the text. How can I do it?
sd.xaml (14.2 KB)

Due to confidentiality, I cannot send the PDF file but you can refer to a sample of it (2nd last page) here https://www.healyconsultants.com/wp-content/uploads/2014/01/Aidan-Due-Diligence-Sample.pdf

if you already know the text what you are looking for (Cloud No…) , whatever you are planning to return would be the same text (Cloud No…).
I dont get your problem clearly.

Sorry maybe i wasn’t clear. I wanted to search for a particular text and get the text back so that based on the text’s position, I can get the next few lines of text following it,

Sanga, try using k.IndexOf(“h-CLOUD NO S12345-AB”).
That will return an integer of the starting position of that text within the large text.
Then use text1.Substring(integer that you got from IndexOf + “h-CLOUD NO S12345-AB”.Length) in order to get the text that comes after the string you are searching for.

1 Like

Hi sorry, where did u get variable k from? I have the variable however it is not in use. As I tried many functions I forgot where I got it from. Thus when I tried using extract2 = k.IndexOf(“h-CLOUD NO S12345-AB”); the validation error is identifier missing.

Hi, it works after a little tweaking thank you.