Hi Ges,
Like Pedro said it's really hard to understand without seeing the query. The query that Pedro posted, I assumed came from you, so unless the OR statement and brackets on your original are set incorrectly, it will work. BTW: I've posted that same query written in more shorthand SQL.
It's important to always include the SITEID in your query as it seems that you've got more than one site and in reality, you only wanted them from the one sited. it's also important to include ISTASK=0 to remove the task work orders, HISTORYFLAG you can remove and you've already stated what statuses you want. That said, IBM have stated that ISTASK and HISTORYFLAG are added in the background by default and so are not needed in the query.
Yes, the relationship that you have mentioned does filter on the WONUM and the SITEID, so that is only about getting info from the work order. The WMASSIGNMENT is a view that uses the following Where Clause
FROM assignment RIGHT OUTER JOIN workorder on assignment.wonum = workorder.wonum and assignment.siteid = workorder.siteidAs you can see, it does not filter out the task, so even though your Work Queries do, the tasks will still show (unless you uncheck "Include Tasks in Scheduler" which is filtered by the code on the Gantt Chart). BTW: If you not assigning people at the task level, there is no need to have tasks displayed. This can be seen as frustrating, but it's a reality that you assigning only at the work order, so no need for tasks.
There should be no way, you should be seeing assignments from another site unless your Work Queries are not filtered.
If the work has a Job Plan, then you can set the Include Tasks in Schedule? to off in the Job Plan, otherwise, yes it's a manual change per work order.
=========================
(status in ('APPR','CONF','HOLD','INPRG','WAPPR','WMATL','WSCH') and (woclass = 'WORKORDER' or woclass = 'ACTIVITY') and upper(crewid) = 'F_F_C' and historyflag = 0 and persongroup = 'F_F_C_1' and istask = 0 and siteid = 'TMMFF' and worktype IN ('CM','H&S','INV','KZN','MBR','MOD','PM','PMD','REQ','STAT','STATD','TRG'))------------------------------
===============================
Craig Kokay,
Lead Senior Maximo/IoT Consultant
ISW
Sydney, NSW, Australia
Ph: 0411-682-040
=================================
#IBMChampion2022
------------------------------