Is there a way to get the newest LaborDtl for a JobNum. I noticed that several entries have the same JobNum, probably from me starting and stopping jobs over and over for one employee. I would like only the newest entries and ignore the duplicates that are not relevant anymore.
I’m using /api/v2/odata/t300/Erp.BO.LaborSvc/GetByID and passing in laborHedSeq
Yes and that was great advice for getting my BAQ to work. What I’m trying to do now is filter down the number of items coming back in LaborDtl to only show the most resent JobNum entries.
Do you have a test system John? Cause you can try clocking in and out of a job and querying the labor dtl table while you are clocked in and clocked out and when you complete a job or don’t complete a job and you’ll be able to answer questions like the one you just asked pretty easily.
If those are your conditions, a baq like this should do it:
select top (1)
[LaborDtl].[LaborDtlSeq] as [LaborDtl_LaborDtlSeq]
from Erp.LaborDtl as LaborDtl
where (LaborDtl.LaborHedSeq = @laborHedSeq and LaborDtl.ActiveTrans = false and LaborDtl.Complete = false)
order by LaborDtl.LaborDtlSeq Desc