Interview Questions

Wednesday, May 14, 2014

Get employee detail by code Ax 2012

static void EmployeeDetails(Args _args)
{
    HcmWorker                     hcmWorker;
    DirPartyTable                 dirPartyTable;
    DirPartyLocation              dirPartyLocation;
    LogisticsPostalAddress        logisticsPostalAddress;
    LogisticsLocation             logisticsLocation;
    HcmPersonPrivateDetails       hcmPersonPrivateDetails;
    HcmEmployment                 hcmEmployment;
    LogisticsElectronicAddress    logisticsElectronicAddress;
    HcmWorkerTitle                hcmWorkerTitle;
    HcmTitle                      hcmTitle;
    HcmPositionWorkerAssignment   hcmPositionWorkerAssignment;
    HcmPositionDetail             hcmPositionDetail;
    HcmPosition                   hcmPosition;
    HcmJob                        hcmJob;
    OMOperatingUnit               oMOperatingUnit;
    ;

    select hcmWorker where hcmWorker.Person == 5637144585
    join dirPartyTable where dirPartyTable.RecId == hcmWorker.Person
    join hcmPersonPrivateDetails where hcmPersonPrivateDetails.Person == hcmWorker.Person
    join hcmEmployment where hcmEmployment.Worker == hcmWorker.RecId
    join dirPartyLocation where dirPartyLocation.Party == dirPartyTable.RecId
    join logisticsPostalAddress where logisticsPostalAddress.Location == dirPartyLocation.Location;

    select dirPartyLocation where dirPartyLocation.Party == dirPartyTable.RecId
    join logisticsLocation where logisticsLocation.RecId == dirPartyLocation.Location
    join logisticsElectronicAddress where logisticsElectronicAddress.Location == logisticsLocation.RecId
    && logisticsElectronicAddress.Type == LogisticsElectronicAddressMethodType::Phone;



    while select hcmPositionWorkerAssignment where hcmPositionWorkerAssignment.Worker == hcmWorker.RecId
    join hcmPosition where hcmPosition.RecId == hcmPositionWorkerAssignment.Position
    join hcmPositionDetail  where hcmPositionDetail.Position == hcmPosition.RecId
    join hcmJob where hcmJob.RecId == hcmPositionDetail.Job
    join oMOperatingUnit where  oMOperatingUnit.RecId == hcmPositionDetail.Department
          && oMOperatingUnit.OMOperatingUnitType == OMOperatingUnitType::OMDepartment
       {
            info(strFmt("Name of Worker : %1 , Date of Birth : %2 , Date Of Joining : %3 , Address : %4 , Phone : %5, Department : %6 ,  Postion : %7 , Designation : %8 , Job : %9" ,
            dirPartyTable.Name,hcmPersonPrivateDetails.BirthDate,hcmEmployment.ValidFrom,logisticsPostalAddress.Address,logisticsElectronicAddress.Locator,
            oMOperatingUnit.Name,hcmPosition.PositionId,hcmPositionDetail.Description,hcmJob.JobId));
       }


 }

=====================================================================
2---
static void Jobswa(Args _args)
{
    HcmWorker                   hcmWorker;
    HcmPosition                 hcmPosition;
    HcmPositionDetail           hcmPositionDetail;
    HcmJob                      hcmJob;
    HcmEmployment               hcmEmployment;
    DirPerson                   dirPerson;
    DirPartyPostalAddressView   dirPartyPostalAddressView;
    HcmPersonPrivateDetails     hcmPersonPrivateDetails;
    OMOperatingUnit             OMOperatingUnit;
    HcmMyDepartments            hcmMyDepartments;
    HcmPositionWorkerAssignment hcmPositionWorkerAssignment



    ;

     select hcmWorker where hcmWorker.Person == 5637144585                          join dirPerson where
                           hcmWorker.Person == dirPerson.RecId                      join hcmPersonPrivateDetails where
                           dirPerson.RecId == hcmPersonPrivateDetails.Person        join hcmEmployment where
                           hcmWorker.RecId ==   hcmEmployment.Worker  join OMOperatingUnit where
                           OMOperatingUnit.HcmWorker == hcmWorker.RecId             join hcmMyDepartments where
                           hcmMyDepartments.DepartmentRecId == OMOperatingUnit.RecId;
    {


        info(strFmt("startdate : %1",hcmEmployment.ValidFrom));
        info(strFmt("Workerid :%1", hcmWorker.PersonnelNumber));
        info(strFmt("Person name: %1",dirPerson.Name));
        info(strFmt("Date of birth: %1",hcmPersonPrivateDetails.BirthDate));
        info(strFmt("Department : %1",hcmMyDepartments.DepartmentRecId));

        while select hcmPositionWorkerAssignment where

                     hcmPositionWorkerAssignment.Worker ==   hcmWorker.RecId   join  hcmPosition where
                     hcmPositionWorkerAssignment.Position == hcmPosition.RecId join hcmPositionDetail where
                     hcmPosition.RecId == hcmPositionDetail.Position join hcmJob where
                     hcmPositionDetail.Job == hcmJob.RecId

        {

            info(strFmt("worker position : %1",hcmPosition.PositionId));
             info(strFmt("worker Job : %1",hcmJob.JobId));

        }
    }




}

No comments:

Post a Comment