Big news! The community will be moving to a new platform April 21. Read more.
Big news! The community will be moving to a new platform April 21. Read more.
Captain
Captain
486 views

Unable to apply regular expression on one of the object property

Hi,

In my object repository, i have one object with 'field id' value as 155. Now i want to apply the regular expression on the last digit of the field id.

I'm doing something like 15.* but QTP would not apply this regular expression. I'm doing this by opening the OR manager and updating the object property value.

 

I have also tried to create to description object, using :-


Set TeScreenNum = Description.Create()
TeScreenNum("micclass").Value = "TeField"
TeScreenNum("field id").Value = "15" & ".*"

AND

Set TeScreenNum = Description.Create()
TeScreenNum("micclass").Value = "TeField"
TeScreenNum("field id").Value = "15.*"

 

But both of the above methods are not working. I'm getting general run error when scripts passes through the statement with above description object. i'm trying to 'text' property value from description object. 

 

 

Please suggest. thanks!

 

0 Likes
6 Replies
Cadet 3rd Class
Cadet 3rd Class

Hi,

 

I just wanted to check doesn't it have any other properties to match and find.? if its possible could you please share the Object properties.

0 Likes
Knowledge Partner Knowledge Partner
Knowledge Partner

Have you tried the other DP method, something like:

Window("XYZ").TeScreenNum("field id:=15.*")

Mark Smith.

0 Likes
Commander
Commander

Try to apply regular express into entire value

 

Set TeScreenNum = Description.Create()
TeScreenNum("micclass").Value = "TeField"
TeScreenNum("field id").Value = ".*"

 

Thanks

Balaji

0 Likes
Captain
Captain

Hi 

 

Set TeScreenNum = Description.Create()
TeScreenNum("micclass").Value = "TeField"
TeScreenNum("field id").Value = ".*"

 

above solution will accept any value like 154 or 120 or 000, right ? if it so then, it is not a solution to my issue, as i want the third digit to be a anything, first two digits has to be '15'

 

Please suggest.

 

 

Regards,

Vineet

 

0 Likes
Commander
Commander

Okay, As per my suggestions that you can better to handle in script level , I mean  write a logic to get third value during run time.

1) To get entire values using GetRoProperty

2) Verify\Validated whatever the third digit using len function.

 

Thanks

Balaji

0 Likes
Commander
Commander

Hi Vineet,

Please reach me I can able to help you.

Thanks
Balaji
balajiqa11@gmail.com
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.