cancel
Showing results for 
Search instead for 
Did you mean: 

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Nayak_Ragh
Occasional Contributor

Re: How to extract the data from the ObjectProperty

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);

View solution in original post

7 REPLIES 7
hkim5
Staff

Re: How to extract the data from the ObjectProperty

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

Re: How to extract the data from the ObjectProperty

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.

Marsha_R
Community Hero

Re: How to extract the data from the ObjectProperty

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

 

 

Nayak_Ragh
Occasional Contributor

Re: How to extract the data from the ObjectProperty

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

Re: How to extract the data from the ObjectProperty


@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.

Nayak_Ragh
Occasional Contributor

Re: How to extract the data from the ObjectProperty

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);

View solution in original post

sonya_m
Community Manager

Re: How to extract the data from the ObjectProperty

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


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors