I’ve looked for a solution and havent found anything relevant.
My goal is to make a BAQ to show only employess who’ve had labor activity in the last X days
I am using LaborDtl to filter the createdate then trying to link that to EmpBasic to get the name.
It’s effective but I’d prefer to not have loads of duplicate names on the result list. I’ve tried to finagle it with join types and even played with a subquery (which I have no experience with) to no avail.
I think if I had to, I could call that BAQ from code and delete duplicate rows from the results table as a last resort. Any thoughts or advice? I’d mention I don’t have access to the SQL server so creating a view is out of the question.
If you use a sub-query to return the last labor transaction date, you can then filter that to your criteria. Then you can link that sub-query to your employee record so that you only receive a single line for each employee.
Ok Jose, let’s assume for a minute that I’m an idiot…
How can I do a groupBy? I click GroupBy on the field I want in Display Fields but then I get this error:
Severity: Error, Table: , Field: , RowID: , Text: Column ‘Erp.LaborDtl.EmployeeNum’ is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
Jim, I need more than just the last because multiple people can work on the same job. I did play around with that idea though using SubQueries but I found I lack the training to be effective up to this point. I think I got the gist of it, but ultimately couldn’t sort it out.
Works like a champ! Thanks a ton. Now to figure out what you did. Feel free to break it down.
I am especially puzzled about where Calculated_LaborDate is defined. I expected I could select it and open it with the Calculated Field Editor to see what was happening but nothing showed.
Okay - I see. I was looking at the wrong sub Q. I guess that field has to be on the other as a place holder. On the proper sub Q (Activity) I can see it’s just the count of the records: Count(LaborDtl.PayrollDate)
ok you twisted my arm…here is my take… (no need for subqueries if you use group by… not to say subqueries are wrong… but there are many ways to skin a cat) LaborActivityThing.baq (16.1 KB)
Add LaborDtl and link it to EmpBasic
Filter the LaborDtl by a Param for Number of days… so you can say Give me Employees with Activity in the last X days
I thought you said you are trying to get Employees that have activity in the last X Days… is that what you want? If so the query I provide you does that without subqueries… I do use the CreateDate or PayrollDate but only to filter the X days… (if that makes sense)
Or am I misunderstanding?
No you got. And I follow using the date for the filtering. But assuming we just used PayrollDate as opposed to the CreateDate, couldn’t there still be duplicates?