The PSAResourceTable is used often in the Project Management & Accounting module. It holds a list of valid worker resources and is used when assigning workers to tasks. What isn’t immediately clear is how to use it. The first problem is that it is used like a temp table, but it isn’t defined as a temp table. Instead, it has a Guid field called UserSesssion that controls who will see the records. You also won’t easily find any insert statements inserting records into the table. That is where the ProjProjectResourceList class comes in. This class is responsible for populating the PSAResourceTable and deleting the records when you are done.
To see this in action you will first need to add some workers as project resources. Go to Project management and accounting/Common/Project resources/Resources and click the Resource button on the Action Pane.
Now we can query the PSAResourceTable for our resources.
private void findResources()
// This Guid is used to filter the table to just our results.
userSession = newGuid();
// Construct the ProjProjectResourceList
resourceList = ProjProjectResourceList::construct(userSession);
// These dates are used to filter the workers
startDateTime = DateTimeUtil::getSystemDateTime();
endDateTime = DateTimeUtil::maxValue();
// Populate the PSAResourceTable
// Now we can query the table for our resources.
while select Resource, ResourceCalendar, ResourceDataArea, LegalEntity from resources
where resources.UserSession == userSession
&& resources.ResourceSet == ProjResourceSet::Cache
where HcmWorker.RecId == resources.Resource
// Our records will remain in the table until we clear them out because this
// isn’t a real temp table.
Make sure you call clearResources and clearResourceSet when you are finished with the table so you don’t pollute it with orphaned records.