web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

SQL query filter active employees only

(0) ShareShare
ReportReport
Posted on by

I have the following sql query and I want to filter out active employees (workers) only.  I am new to AX 2012 and so I am not sure how to do this with the new tables because there doesn't seem to be a status field anymore.  I appreciate any advice. - Thanks!

Select

e.personnelnumber as EmployeeId,

dir.name as 'Employee Name',

ptp.categoryid,

ptp.qty,

ptp.projtransdate

 

from projtransposting ptp

 

join DimensionAttributeValueCombination  dimattr

on dimattr.recid = ptp.LedgerDimension

 

join mainAccount mAcc

on mAcc.Recid = dimattr.MainAccount

 

left outer join hcmworker e

       on ptp.worker = e.recid

 

left outer join dirpartytable dir

      on e.person=dir.recid

 

 where ptp.dataareaid = 'al'

and (ptp.ledgertransdate >= '01/01/2014'

and ptp.ledgertransdate <= '01/31/2014')

and CATEGORYID = 'pto'

and left (e.personnelnumber,3) != '330%'

 

order by 1

*This post is locked for comments

I have the same question (0)
  • Verified answer
    David Massey Profile Picture
    on at

    Employment is date effective.  Look at the form HcmWorkerLookup for an examples of setting ranges for the various type of employment conditions.  The table in your example above is historical data (ProjTransPosting). I'm unclear as to why you want to filter the data by active employment in this table.

  • Verified answer
    Community Member Profile Picture
    on at

    Thanks for replying to my post David.  I will look at the form you mentioned.  We want to filter out the inactive employees because we are loading the data into our payroll software and it's easier when we don't have to pick out the terminated employees from the list.

    Thanks again for the help.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans