Working with Smart Select

The Select Type field on the Import/Export Payroll Data component - Import/Export Payroll Data page has three options: All Employees in Group, Manually Select, and Smart Select. The Smart Select option provides substantial performance benefits by enabling you to process only those employees who have had online changes since the last time the Export process was run.

When deciding whether to use Smart Select, consider the following:

  • Smart Select is recommended for use with very large companies.

  • To activate Smart Select, you must add a PeopleCode function, UPDATE_SMARTSELECT, to each EMPLID-keyed table that is set up in the PS Tables component—including those EMPLID-keyed tables that are referenced indirectly through views.

    When data changes in these tables, a record that includes the EMPLID and EMPL_RCD key fields, as well as the data change, is written to the PS_PI_PRESELECT table. When you run the Export process using the Smart Select option, Payroll Interface processes only those records in the PS_PI_PRESELECT table.

  • Smart Select detects online changes only.

    At least once per payroll cycle you should run the Export process with the All Employees in Group option selected to process records that have changes but do not have the PeopleCode function attached, or to process records that have changes that were made outside of the online system (for example, deduction calculations or a batch update to your employees).

    Note: If you update employees other than online, but they represent only a small percentage of all employees, you can manually update the PS_PI_PRESELECT table for these employees and then run the Export process with the Smart Select option selected.

  • Smart Select detects changes to EMPLID-keyed tables only. You should run the Export process with the All Employees in Group option selected whenever you change the Payroll Interface definition, change any tables referenced in the PS Tables component that is not keyed on the EMPLID field, or are processing a group of employees for the first time.

Activating Smart Select

Payroll Interface provides a PeopleCode function, UPDATE_SMARTSELECT, which tracks online changes and makes the information available to the Export process. To activate Smart Select, you must add this function to each EMPLID-keyed table that is referenced by the PS Tables component—including those EMPLID-keyed tables that are referenced indirectly through views. The example in this topic shows how to activate Smart Select for the Citizenship table (record). Follow these same steps to activate Smart Select for other EMPLID-keyed tables.

To activate the Smart Select code for the Citizenship table:

  1. Start PeopleSoft Application Designer.

  2. Select File, Open.

    The Open Definition dialog box appears.

  3. From the Open Definition dialog box, do the following:

    • For the Definition field, select Record.

    • For the Name field, enter CITIZENSHIP.

    • Select Open.

    The CITIZENSHIP (Record) dialog box appears.

  4. Select View, PeopleCode Display.

    The CITIZENSHIP (Record) dialog box displays a grid.

  5. For the EMPLID field, locate the SPo (SavePostChange) cell in the grid.

    PeopleCode may or may not be indicated for the EMPLID field in the SPo cell.

  6. Double-click the SPo cell to open the PeopleCode editor.

    The CITIZENSHIP.EMPLID.SavePostChange (Record PeopleCode) dialog box appears.

  7. For the EMPLID field, add the following PeopleCode:

    Declare Function UPDATE_SMARTSELECT PeopleCode PI_PRESELECT.PI_SELECT_TYPE FieldFormula;

  8. For the EMPLID field, add the following PeopleCode:

    • If EMPL_RCD is a field in the CITIZENSHIP table, add:

      UPDATE_SMARTSELECT (EMPLID, EMPL_RCD, 'Y');

    • If EMPL_RCD is not a field in the CITIZENSHIP table, add:

      UPDATE_SMARTSELECT (EMPLID, 0, 'N');

      Note: The 'Y' or 'N' at the end of the parameter list indicates whether EMPL_RCD exists in the record. If it does not exist, then all jobs for a multijob employee will be processed in the next Smart Select export.

  9. Save the PeopleCode and the table (record).

This example shows the Citizenship table (record):

Image: CITIZENSHIP table (record)

This example illustrates the fields and controls on the CITIZENSHIP table (record).

CITIZENSHIP table (record)

This example shows the PeopleCode that is required to activate Smart Select:

Image: PeopleCode function UPDATE_SMARTSELECT

This example illustrates the fields and controls on the PeopleCode function UPDATE_SMARTSELECT.

PeopleCode function UPDATE_SMARTSELECT

PeopleCode Function UPDATE_SMARTSELECT

The PeopleCode function UPDATE_SMARTSELECT tracks and records online data changes using the PS_PI_PRESELECT table.

Function UPDATE_SMARTSELECT(&EMPLID, &EMPL_RCD, &EMPL_RCDN_FLAG) &COUNT = 0; SQLExec("SELECT COUNT(*) FROM PS_PI_PRESELECT WHERE EMPLID=:1 AND EMPL_RCD = :2 AND PI_SELECT_TYPE='C' AND PI_RUN_NUM= 0", &EMPLID, &EMPL_RCD, &COUNT); If &COUNT > 0 Then SQLExec("UPDATE PS_PI_PRESELECT SET DATETIME_STAMP=%CurrentDateTimeIn WHERE EMPLID=:1 AND EMPL_RCD = :2 AND PI_SELECT_TYPE='C' AND PI_RUN_NUM= 0", &EMPLID, &EMPL_RCD); Else SQLExec("INSERT INTO PS_PI_PRESELECT (PI_SELECT_TYPE,EMPLID,EMPL_RCD,DATETIME_STAMP, EMPL_RCDN_FLAG,PI_RUN_NUM) VALUES ('C',:1,:2,%CurrentDateTimeIn,:3,0)", &EMPLID, &EMPL_RCD, &EMPL_RCDN_FLAG); End-If; End-Function;