Ask a Question

How to extract the data from the ObjectProperty

SOLVED
Nayak_Ragh
Occasional Contributor

How to extract the data from the ObjectProperty

 

 

I have spied on an object using 'Set Variable Value' assigning it to a new variable (Var1). Its value is  Aliases.Ax32.Purchase_order.TaskPageLayout.PartHostSplitContainer.SplitterPanel.NativeWindowControl.NativeWindowWithEvents.PurchTable.AxTabCtrl.AxPaneWnd.AxPaneWnd.Cable_Assembly_Llc.Value

 

Now I need to extract the content of this 'Value' at the end, split it and extract particular data.

 

Could you please advise how to achieve this?

This is a desktop application and my operation is to capture the ID generated, to be used as an input for further testing.

7 REPLIES 7
hkim5
Staff

ok so you grabbed the value (I'm assuming string) , what does the full string look like

what are the delimiters? how would you distinguish that something is an ID number? is it always the same number of digits? 

 

you are going to have to script some sort of a string concatenation function... maybe with more info someone in the community can help you out 🙂 

Best,
Justin Kim
Nayak_Ragh
Occasional Contributor

The 'Value' I grabbed looks something like this  - 081699 : 10301 - Cable Assembly Llc, which changes everytime I run the test and I need to extract 081699, to be used as an input in further tests.

The aqString methods will help you pick that string apart and get just the part you want.

 

https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqstring/index.html

 

 


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
Nayak_Ragh
Occasional Contributor

In the ObjectProperty Aliases.Ax32.Purchase_order.TaskPageLayout.PartHostSplitContainer.SplitterPanel.NativeWindowControl.NativeWindowWithEvents.PurchTable.AxTabCtrl.AxPaneWnd.AxPaneWnd.Cable_Assembly_Llc.Value,
the Value at the end is dynamic. My problem is how to fetch that value so that i can split it based on the separators.
Example value is "081699 : 10301 - Cable Assembly Llc"

Once i assign above value to a variable, i can use aqString to split this string and assign just 081699 to another variable, that can be used for further test.

Now, i am stuck at the step-1 whre i am not able to fetch the string "081699 : 10301 - Cable Assembly Llc"

Marsha_R
Community Hero


@Nayak_Ragh wrote:

 

 

I have spied on an object using 'Set Variable Value' assigning it to a new variable (Var1). Its value is  Aliases.Ax32.Purchase_order.TaskPageLayout.PartHostSplitContainer.SplitterPanel.NativeWindowControl.NativeWindowWithEvents.PurchTable.AxTabCtrl.AxPaneWnd.AxPaneWnd.Cable_Assembly_Llc.Value

 

This Var1 should contain the value that you want.  Now apply aqString as needed to that variable and save that to a new variable so you can see the result without losing the original value.


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
Nayak_Ragh
Occasional Contributor

This is the code I used and it worked for me

var obj = aqObject.GetPropertyValue(Aliases.Ax32.Purchase_order.TaskPageLayout.PartHostSplitContainer.SplitterPanel.NativeWindowControl.NativeWindowWithEvents.PurchTable.AxTabCtrl.AxPaneWnd.AxPaneWnd.Cable_Assembly_Llc, "Value");

var objValue = aqConvert.VarToStr(obj);

var obj1 = objValue.split(":");

var objFirst = obj1[0];

Log.Message(objFirst);

sonya_m
SmartBear Alumni (Retired)

@Nayak_Ragh Thank you so much for sharing the code with us!


Sonya Mihaljova
Community and Education Specialist

cancel
Showing results for 
Search instead for 
Did you mean: