varun_masuraha
3 years agoContributor
How to find object(s) with conditions on numeric properties, like “>x”, “<x”, “not 0", etc. ?
Hi, Consider a script example: >>> results = myObject.FindAll( ["contentText", "ChildCount"], ["Employer", << greater than 5 >>] ); How to implement the red part in above query, where we're i...
- 3 years ago
Hi,
Technically, something like this (untested regex) should work:
results = myObject.FindAll( ["contentText", "ChildCount"], ["Employer", "regexp:^([6-9])|(\\d{2,})$"] );
where ([6-9])|(\\d{2,}) regex means: either a figure in a range from 6 to 9 or any combination of two or more figures.
However I am not sure that this approach is easily parameterizable (for the case when today you are looking for child count greater than 5, but tomorrow you will need to search for 7 or more children).
So I, probably, would just search for all "Employer"s and then loop through the returned array and remove those elements that do not fit your condition.