underqualified
5 years agoOccasional Contributor
Iterating through items
Hey everybody, me again This time, my issue is that I have to iterate through a series of objects. The objects have objectID '0', '1', '2', and so on, but the amount of objects is not fixed. ...
- 5 years ago
Hello,
These are my ideas for solving your problem:
1) Try using regexp using the .find() methods, with this method you can only get the items you want inside the table, or maybe an object
Doc: https://support.smartbear.com/testcomplete/docs/reference/misc/regular-expressions.html
2) Write your own JavaScript code to select the item you want to have inside the data object. Run this script with TestComplete.
Doc: https://support.smartbear.com/testcomplete/docs/app-testing/web/general/common-tasks/javascript.html
3) it's better to use "do while" instead of "while" in your situation.
4) Download all posts from findxxx() -> debug object -> use e.g. javascript .filter() on it and filter the items you only want to have.
Sample function:
var filteredData= findElements.filter(function(val) { return dataObj.indexOf(val) == -1 });