pmnum is not null and pmnum in (select pmnum from workorder group by pmnum having count(wonum) <= 4)
It's possible that the PM Counter could have been adjusted, especially if you have Job Plan Sequences in use -- so that the Counter is greater than 4, but it hasn't actually generated 4 Work Orders.
At least in my usage, I wouldn't rely on the Work Order's Work Type to determine if it is a PM or not. The most reliable source is if WORKORDER.PMNUM is null or not (at least for finding the Parent WOs that came from PMs; not so much for Children created from a PM that has a Route. . .)
------------------------------
Travis Herron
Pensacola Christian College
------------------------------
Original Message:
Sent: 04-25-2025 11:58
From: Glen Holt
Subject: Workflow Condition to route PM Generated Work to Reviewer task if pmcounter <=4
I have a PM subprocess that I would like to have a condition expression evaluate if a PM has generated 4 or less work orders.
These work orders are then moved to planning task for review and updating if necessary. If the generated work orders don't meet that <= 4 day criteria they
go directly to the associated trade. I thought this would be an easy one, but so far, no luck. Everything is moving to the trade regardless of how many workorders
have been generated. Any ideas? See current query I tried below:
worktype in ('PM','PMA')
AND pmnum is not null
AND exists (
select 1 from pm
where pm.pmnum = workorder.pmnum
and pmcounter <= 4
)
Thanks for any help that can be provided!
#Administration
------------------------------
Glen Holt
King County
------------------------------