cancel
Showing results for 
Search instead for 
Did you mean: 

Using data from excel sheet for FindChild and passing as regex

SOLVED
Contributor

Using data from excel sheet for FindChild and passing as regex

Hi Everyone,

 

Thanks for helping. I am using a findChild method and passing in the properties from excelsheet.

 

Set Loading= Aliases.DataAcquisition........

           PropArray = Array("UITracingText")
           ValuesArray = Array("*Loader 01*") ----> This value would need to come from an excel sheet Driver.Value(1)) but needs to be able to match part only Loader 01 as UITracingText is a long string.

Set Loading = Loading.FindChild(PropArray, ValuesArray, 10000)

 

 ValuesArray = Array("*Loader 01*") ----> This value would need to come from an excel sheet Driver.Value(1)) but needs to be able to match part only Loader 01 as UITracingText is a long string. If i dont use the value from exel sheet, then i can simple make it  ValuesArray = Array("*Loader 01*") but i only want string which are matching.

 

Thanks for helping.

 

Sudha

1 ACCEPTED SOLUTION

Accepted Solutions
Community Hero

Re: Using data from excel sheet for FindChild and passing as regex

Simply concatentate the string...

 

 

ValuesArray = Array("*" & Driver.Value(1) & "*")

 

This will put the value from that column in the array appropriately.

 


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available

View solution in original post

3 REPLIES 3
Community Hero

Re: Using data from excel sheet for FindChild and passing as regex

Simply concatentate the string...

 

 

ValuesArray = Array("*" & Driver.Value(1) & "*")

 

This will put the value from that column in the array appropriately.

 


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available

View solution in original post

Re: Using data from excel sheet for FindChild and passing as regex

Hi
If I understood correctly, need to get "Loader 01" text from a long string and paste to the "FindChild" method
You can try this code:
...
Dim regEx, Matches, value
Set regEx = New RegExp
regEx.Pattern = "Loader \d\d"
Set Matches = regEx.Execute(Driver.Value(1))
if (Matches.Count <> 0) then value = Matches.Item(0).Value
Set Loading = Loading.FindChild("UITracingText", "*" + value + "*", ...)
...

Contributor

Re: Using data from excel sheet for FindChild and passing as regex

Thank you 

New Here?
Join us and watch the welcome video:
Watch the new Interview