Anchor Troubles

Hey! I’m trying to get a $ value using the word “Total” as an anchor. After playing around with the anchor activity, I am unable to get the text. Is there a selector that I can create specifically for the word total. (Photos Attached)Capture

1 Like

You can read the whole text from the notepad file and then look for the keywords “DAILY TOTAL”. Once you find them split the line that they’re on by spaces and the 3rd and 4th items will be the two dollar amounts.

What activity do I use to capture this line? I’ve been using ‘find element’ as the anchor and ‘get text’ as the action, but the best output that I’ve gotten has been all of the text in the text file. Is there a specific line that I can add to the selector to find total?

Hi @mplo724

As said so we can get the value of the risk without anchor base activity and the reason is we have the text file ready with us from where we can get the value we need
—use read text file activity and pass the file path as input and get the output as a string variable named out_text
—use a assign activity like this
Out_textarray = out_text.Split(Environment.Newline.ToArray())
Where Out_textarray is a variable of type string array

—the use a for each loop and pass the above variable Out_textarray as input and change the type argument as string in the property panel
—inside the for each loop use a if condition and put a condition like this
If this condition passes it will go to THEN part where we get the value of total with a assign activity like this
Out_Value = Split(item,” “)(2).ToString.Trim
Where the output would be $228.29

If the above condition fails it will go to else part where we can leave it simply without any activities

Hope this would help you
Kindly try this and let know for any queries or clarification
Cheers @mplo724


Apologies for the late response. Will the line total = Split(line, " ") (“Total” + 1).ToString.Trim work? Each pdf won’t have the same format, so my goal is to get the string to the right of “Total”. Unfortunately, I’m struggling to find a creative way to quantify the index of the numerical total as you can see.