04-30-2020, 01:39 PM
(This post was last modified: 04-30-2020, 01:39 PM by remkonoteboom.)
That's a tricky one to do in pure expression language (or pure SQL even) because it violates data integrity. Technically, it would be argued that some trigger should cascade any foreign key relationships and delete them or at least clear them. Then you could easily search for a NULL value.
If they have already been deleted, then I am not sure how to do this without Python and this would be pretty heavy if you have a lot of tasks.
If they have already been deleted, then I am not sure how to do this without Python and this would be pretty heavy if you have a lot of tasks.
Code:
shot_codes = Search.eval("@GET(vfx/shot.code)")
shot_codes = set(shot_codes) # sets are faster to look up
search = Search("sthpw/task")
search.add_filter("search_type", "vfx/shot%", op="like") # to reduce task to just shot tasks
tasks = search.get_sobjects()
for task in tasks:
if task.get("search_code") not in shot_codes:
print("Not found: ", task.get_code() )