How to get sObjects without tasks? - Printable Version +- TACTIC Open Source (http://forum.southpawtech.com) +-- Forum: TACTIC Open Source (http://forum.southpawtech.com/forumdisplay.php?fid=3) +--- Forum: TACTIC Discussion (http://forum.southpawtech.com/forumdisplay.php?fid=4) +--- Thread: How to get sObjects without tasks? (/showthread.php?tid=70) |
How to get sObjects without tasks? - listy - 01-27-2020 Hi All! It is really easy to get tasks of the sobject @SOBJECT(prod/asset.sthpw/task) But how i can get all "prod/asset" without created tasks? Example output: with tasks: ['obj1', 'obj2] without tasks: ['obj3', 'obj4'] Thanks! RE: How to get sObjects without tasks? - remkonoteboom - 01-28-2020 Finding the negative is always more difficult. You could use this: @SOBJECT(prod/asset['code','not in',@GET(sthpw/task['search_code','like','ASSET%'].search_code)]) Because the two are in different databases, the sql statement produced will be rather large if you have a lot of assets. This is one reason that I filter the tasks for search_codes starting with 'ASSET%' first. If Postgresql could join between databases like some other databases, this operation would be much more efficient. ... but it should work and postgres is very tolerant of very large sql statements. If you actually want to see what sql is being produced from an expression, you can always use the SEARCH command: from pyasm.search import Search expr = "@SEARCH(prod/asset['code','not in',@GET(sthpw/task['search_code','like','ASSET%'].search_code)])" search = Search.eval(expr) print(search.get_statement()) This is a good way of diagnosing exactly what the expression language is doing. RE: How to get sObjects without tasks? - listy - 01-28-2020 Hi, Remko! Thanks for Your help. This is almost what i am trying to get. To get Your expression work i had to add '|' delimiter. expr = "@SOBJECT(complex/scenes['code', 'not in', @GET(sthpw/task['search_code','like','SCENES%'].search_code), '|'])" sob = Search.eval(expr) But, what i try to get, is sObject that not have ANY task assigned (this is not so clear from my first post, sorry). I think i will manage it by myself. Thanks! Sooo, looks like i was wrong. Error with Your expression: Fault: <Fault 1: "'list' object has no attribute 'startswith'"> Tried to use something like "@JOIN(@GET(sthpw/task['search_code','like','SCENES%']['process', 'animation'].search_code), '|')", but no luck RE: How to get sObjects without tasks? - listy - 02-06-2020 (01-28-2020, 02:52 PM)remkonoteboom Wrote: from pyasm.search import SearchThis is actually returning list of sobjects. How i can get statement from list? RE: How to get sObjects without tasks? - remkonoteboom - 02-06-2020 I'm sorry, this doesn't seem to work in 4.5. It seems that the 4.5/4.6 cannot handle the sub expressions in the filter. This expression does works fine: @SEARCH(prod/assets['code', 'not in', 'a|b|c']) It works fine in 4.7+ |