Category: %SelectAllByKey

PeopleTools Reference: Meta-SQL %SelectByKey

generates a select statement based on the given record definition.

Remember that a record object (not a record definition) stores both the record structure (table name and field name) and the field values. Therefore, the system has everything it needs to write a select statement: select … list of fields … from … table name … where … key field name … = … value for that field … and so on.

Related: %SelectByKeyEffdt

does the same thing except it adds the effective dating criteria to limit it to the most recent rows.


Local Record &recJob;
&recJob = CreateRecord(RECORD.JOB);
&recJob.EMPLID.value = &emplid;
&recJob.EMPL_RCD.value = &empl_rcd;
&recJob.EFFDT.value = &effdt;
&recJob.EFFSEQ.value = &effseq;
SqlExec(“%SelectByKey(:1)”, &recJob, &recJob);
WinMessage(“Job Code: ” | &recJob.JOBCODE.value);

Local Record &recNames, &recOutput;
&recNames = CreateRecord(RECORD.NAMES);
&recOutput = CreateRecord(RECORD.NAMES);
&recNames.EMPLID.value = &emplid;
&recNames.NAME_TYPE.value = “PRI”;
SqlExec(“%SelectByKeyEffdt(:1)”, &recNames, %Date, &recOutput);