How to extract the data from the ObjectProperty
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 🙂
Justin Kim
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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"
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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);
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Nayak_Ragh Thank you so much for sharing the code with us!
Sonya Mihaljova
Community and Education Specialist
