Question

String Manipulation

  • 27 February 2024
  • 7 replies
  • 79 views

Badge +5

Hi ,

 

Im trying to find out a  easy way solution for string extraction. 

Example: 1. Im unable to connect to VPN in the Org

  1. The VPN is not connecting 

so here the sentence will be different but i need to check the VPN word is there or not (for this i used if condition ).. and i need to extract that VPN word alone from the dynamic sentence.

Can someone help me out to fix this?

 

Thanks in advance !

 


7 replies

Userlevel 4
Badge +7

One of the easiest ways to do this is to use the IF action, based from a string variable, and see if it “includes” (or I like to call it “contains”) the word “VPN”.

Badge +5

Yes i used that ..after finding the availability of word i need to extract that specific word alone. 

Since the bot will be handling large data i need to fix for different other cases as well 

 

Userlevel 4
Badge +7

Maybe I don’t understand, but if the IF action detects that the word “VPN” is present, why would you need to extract it? You know it’s there.

OTOH: You can use the String: Find action to extract the position of the word “VPN” in the sentence then a String: Substring… but again, check to make sure you really need that.

Badge +5

i tried this though but for somecases the expected output is coming but for some cases not 

Userlevel 4
Badge +7

The actions themselves won’t give inconsistent results, so I might suggest running your automation in Debug mode and inspecting the values of the variables in real time.

https://docs.automationanywhere.com/bundle/enterprise-v2019/page/enterprise-cloud/topics/aae-client/bot-creator/working-with-automation-tasks/cloud-enabling-the-debugging-option.html

Userlevel 1
Badge +3

After using action IF (String condition), and assign your source dynamic variable, and use “includes”, then the string value “VPN”, inside this IF condition, use String FIND from the string action package, then use the source string “as your dynamic variable that contains VPN”, and in the “FIND STRING” write VPN. this will extract the word “VPN” alone from your dynamic variable. and save the output to a new variable

Userlevel 4
Badge +7

Even easier:
If ($stringvariable include “VPN”)
    String: Assign $resultstring = “VPN”

You already know $stringvariable contains “VPN”, so why even bother with trying to isolate the word VPN? You’re doing more work than necessary to get the same effect.   :)

Reply