Você está na página 1de 10

Integrating Population Selection

Purpose
The purpose of this document is to illustrate how to integrate Population Selection into custom processes.

The following conventions where used in the PeopleCode sections to indicate changes that must be made
to work with the custom process.

{Component} – Replace with the name of the custom component


{RUNCONTROLRECORD} – Replace with the name of the run control record
{State Record} – Replace with the application engine state record name

Run Control Page and Record


Add the subpage SCCPS_RUNCNTL_SBP to your page.

Add the subrecord SCCPS_RCNTL_SBR to your run control record below OPRID and RUN_CNTL_ID
Add the following Component PeopleCode

{Component}.GBL.SCCPS_DERIVED.ATTACHADD.FieldChange – No Changes

import SCC_POP_SELECT:PIAComponents:PopSelectController;
import SCC_POP_SELECT:UTIL:EXCEPTION:*;

Component SCC_POP_SELECT:PIAComponents:PopSelectController &PopController;

try

&PopController.FieldChangeAdd();

catch SCC_POP_SELECT:UTIL:EXCEPTION:PopSelectException &Excptn


&Excptn.LogToScreen();
end-try;

{Component}.GBL.SCCPS_DERIVED.ATTACHDELETE.FieldChange – No Changes

import SCC_POP_SELECT:PIAComponents:PopSelectController;
import SCC_POP_SELECT:UTIL:EXCEPTION:*;

Component SCC_POP_SELECT:PIAComponents:PopSelectController &PopController;

try

&PopController.FieldChangeDelete();

catch SCC_POP_SELECT:UTIL:EXCEPTION:PopSelectException &Excptn


&Excptn.LogToScreen();
end-try;

{Component}.GBL.SCCPS_DERIVED.ATTACHVIEW.FieldChange – No Changes

import SCC_POP_SELECT:PIAComponents:PopSelectController;
import SCC_POP_SELECT:UTIL:EXCEPTION:*;

Component SCC_POP_SELECT:PIAComponents:PopSelectController &PopController;

try

&PopController.FieldChangeView();

catch SCC_POP_SELECT:UTIL:EXCEPTION:PopSelectException &Excptn


&Excptn.LogToScreen();
end-try;
{Component}.GBL.SCCPS_DERIVED.SCCPS_PROMPTS.FieldChange – No Changes

import SCC_POP_SELECT:PIAComponents:PopSelectController;
import SCC_POP_SELECT:UTIL:EXCEPTION:*;

Component SCC_POP_SELECT:PIAComponents:PopSelectController &PopController;

try

&PopController.FieldChangeParameters();

catch SCC_POP_SELECT:UTIL:EXCEPTION:PopSelectException &Excptn


&Excptn.LogToScreen();
end-try;

{Component}.GBL.SCCPS_DERIVED.SCCPS_RESULTS_URL.FieldChange – No Changes

import SCC_POP_SELECT:PIAComponents:PopSelectController;
import SCC_POP_SELECT:UTIL:EXCEPTION:*;

Component SCC_POP_SELECT:PIAComponents:PopSelectController &PopController;

try

&PopController.FieldChangePreViewResults();

catch SCC_POP_SELECT:UTIL:EXCEPTION:PopSelectException &Excptn


&Excptn.LogToScreen();
end-try;

{Component}.GBL.SCCPS_DERIVED.SCCPS_RUN.FieldChange – No Changes

import SCC_POP_SELECT:PIAComponents:PopSelectController;

Component SCC_POP_SELECT:PIAComponents:PopSelectController &PopController;

&PopController.FieldChangeExecuteToRecord();

{Component}.GBL.SCCPS_DERIVED.SCCPS_TOOL_URL.FieldChange – No Changes

import SCC_POP_SELECT:PIAComponents:PopSelectController;
import SCC_POP_SELECT:UTIL:EXCEPTION:*;

Component SCC_POP_SELECT:PIAComponents:PopSelectController &PopController;

try

&PopController.FieldChangeToolURL();

catch SCC_POP_SELECT:UTIL:EXCEPTION:PopSelectException &Excptn


&Excptn.LogToScreen();
end-try;
{Component}.GBL.{RunControlRecord}.RowInit - Changes

import SCC_POP_SELECT:PIAComponents:PopSelectController;
import SCC_POP_SELECT:MODEL:ContextMapping:ContextMapper;
import SCC_POP_SELECT:UTIL:EXCEPTION:*;

Component SCC_POP_SELECT:PIAComponents:PopSelectController &PopController;

try
/* Use the ContextMapper to get the context id. In this case it depends on the
navigation - menu, component */
Local SCC_POP_SELECT:MODEL:ContextMapping:ContextMapper &ContextMapper = create
SCC_POP_SELECT:MODEL:ContextMapping:ContextMapper();

{RUNCONTROLRECORD}.SCCPS_CNTXT_ID = &ContextMapper.NavigationToContextID(%Menu,
%Component);
If {RUNCONTROLRECORD}.SCCPS_CNTXT_ID = 0 Then
MessageBox(0, "", 14015, 21, "Unable to Locate Population Selection Context
for this component", %Menu, %Component);
End-If;

/* Create the controller class and pass references to the required pop select
fields
These include the Tool ID, Context ID, Selection Name, etc */
&PopController = create
SCC_POP_SELECT:PIAComponents:PopSelectController(GetRecord(Record.{RUNCONTROLRECORD
}), GetRecord(Record.SCCPS_DERIVED), %OperatorId, {RUNCONTROLRECORD}.RUN_CNTL_ID);

/* This component uses the optional launch tool field so a reference


must be passed to the controller */

&PopController.SetLaunchToolField(GetRecord(Record.SCCPS_DERIVED).GetField(Field.SC
CPS_TOOL_URL));

/* This component also uses the optional View results field...


so it is also passed */

&PopController.SetPreViewResultsFields(GetRecord(Record.SCCPS_DERIVED).GetField(Fie
ld.SCCPS_RESULTS_URL),
GetRecord(Record.SCCPS_DERIVED).GetField(Field.SCCPS_HTMLAREA));

/* Finally call the row init method, this will set the field visiblity,
enablement, etc. */
&PopController.RowInit();

/* Hide the unused population run field */


SCCPS_DERIVED.SCCPS_RUN.Visible = False;

catch SCC_POP_SELECT:UTIL:EXCEPTION:PopSelectException &Excptn


&Excptn.LogToScreen();
end-try;
{Component}.GBL.{RunControlRecord}.SaveEdit – Changes

import SCC_POP_SELECT:UTIL:EXCEPTION:*;
import SCC_POP_SELECT:PIAComponents:PopSelectController;

Component SCC_POP_SELECT:PIAComponents:PopSelectController &PopController;

/* First Ensure that Context and Tool have values */


If None({RUNCONTROLRECORD}.SCCPS_TOOL_ID) Then
Error MsgGet(14015, 13, "Message not found.");

End-If;

If None({RUNCONTROLRECORD}.SCCPS_CNTXT_ID) Then
Error MsgGet(14015, 14, "Message not found.");
End-If;

/* Execute the Pop Select save edit code */


try
&PopController.SaveEdit();
catch SCC_POP_SELECT:UTIL:EXCEPTION:PopSelectException &Excptn
&Excptn.LogToScreen();
end-try;

{Component}.GBL.{RunControlRecord}.SavePreChange – No Changes

import SCC_POP_SELECT:PIAComponents:PopSelectController;
import SCC_POP_SELECT:UTIL:EXCEPTION:*;

Component SCC_POP_SELECT:PIAComponents:PopSelectController &PopController;

/* Save Parm data to the database if needed. */


try
&PopController.SavePreChange();

catch SCC_POP_SELECT:UTIL:EXCEPTION:PopSelectException &Excptn


&Excptn.LogToScreen();
end-try;
{Component}.GBL.{RunControlRecord}.SCCPS_CNTXT_ID.FieldChange – Changes

import SCC_POP_SELECT:PIAComponents:PopSelectController;
import SCC_POP_SELECT:MODEL:ContextMapping:ContextMapper;
import SCC_POP_SELECT:UTIL:EXCEPTION:*;

Component SCC_POP_SELECT:PIAComponents:PopSelectController &PopController;

try

/* Use the ContextMapper to get the context id. In this case it depends on the
navigation - menu, component */
Local SCC_POP_SELECT:MODEL:ContextMapping:ContextMapper &ContextMapper = create
SCC_POP_SELECT:MODEL:ContextMapping:ContextMapper();

{RUNCONTROLRECORD}.SCCPS_CNTXT_ID = &ContextMapper.NavigationToContextID(%Menu,
%Component);
If {RUNCONTROLRECORD}.SCCPS_CNTXT_ID = 0 Then
MessageBox(0, "", 14015, 21, "Unable to Locate Population Selection Context
for this component", %Menu, %Component);
End-If;

/* Create the controller class and pass references to the required pop select
fields
These include the Tool ID, Context ID, Selection Name, etc */
&PopController = create
SCC_POP_SELECT:PIAComponents:PopSelectController(GetRecord(Record.
{RUNCONTROLRECORD}), GetRecord(Record.SCCPS_DERIVED), %OperatorId,
NYU_FIN_CLR_RST.RUN_CNTL_ID);

/* This component uses the optional launch tool field so a reference


must be passed to the controller */

&PopController.SetLaunchToolField(GetRecord(Record.SCCPS_DERIVED).GetField(Field.SC
CPS_TOOL_URL));

/* This component also uses the optional View results field...


so it is also passed */

&PopController.SetPreViewResultsFields(GetRecord(Record.SCCPS_DERIVED).GetField(Fie
ld.SCCPS_RESULTS_URL),
GetRecord(Record.SCCPS_DERIVED).GetField(Field.SCCPS_HTMLAREA));

/* Finally call the row init method, this will set the field visiblity,
enablement, etc. */
&PopController.RowInit();

/* Hide the unused population select checkbox


and run fields */
{RUNCONTROLRECORD}.SCCPS_POP_SEL.Visible = False;
SCCPS_DERIVED.SCCPS_RUN.Visible = False;

catch SCC_POP_SELECT:UTIL:EXCEPTION:PopSelectException &Excptn


&Excptn.LogToScreen();
end-try;
{Component}.GBL.{RunControlRecord}.SCCPS_FILE_PATH.FieldChange – No Changes

import SCC_POP_SELECT:PIAComponents:PopSelectController;
import SCC_POP_SELECT:UTIL:EXCEPTION:*;

Component SCC_POP_SELECT:PIAComponents:PopSelectController &PopController;

try

&PopController.FieldChangeFilePath();

catch SCC_POP_SELECT:UTIL:EXCEPTION:PopSelectException &Excptn


&Excptn.LogToScreen();
end-try;

{Component}.GBL.{RunControlRecord}.SCCPS_POP_SEL.FieldChange – No Changes

import SCC_POP_SELECT:PIAComponents:PopSelectController;
import SCC_POP_SELECT:UTIL:EXCEPTION:*;

Component SCC_POP_SELECT:PIAComponents:PopSelectController &PopController;

try

&PopController.FieldChangePopSelection();

catch SCC_POP_SELECT:UTIL:EXCEPTION:PopSelectException &Excptn


&Excptn.LogToScreen();
end-try;

{Component}.GBL.{RunControlRecord}.SCCPS_QUERY_NAME.FieldChange – No Changes

import SCC_POP_SELECT:PIAComponents:PopSelectController;
import SCC_POP_SELECT:UTIL:EXCEPTION:*;

Component SCC_POP_SELECT:PIAComponents:PopSelectController &PopController;

try

&PopController.FieldChangeQueryName();

catch SCC_POP_SELECT:UTIL:EXCEPTION:PopSelectException &Excptn


&Excptn.LogToScreen();
end-try;

{Component}.GBL.{RunControlRecord}.SCCPS_TOOL_ID.FieldChange – No Changes

import SCC_POP_SELECT:PIAComponents:PopSelectController;
import SCC_POP_SELECT:UTIL:EXCEPTION:*;

Component SCC_POP_SELECT:PIAComponents:PopSelectController &PopController;

try

&PopController.FieldChangeToolID();

catch SCC_POP_SELECT:UTIL:EXCEPTION:PopSelectException &Excptn


&Excptn.LogToScreen();
end-try;
Application Engine PeopleCode
import SCC_POP_SELECT:MODEL:PopSelectFacade;

/* Instance of the Population Selection Facade Class */


Local SCC_POP_SELECT:MODEL:PopSelectFacade &PopSelectFacade;

&PopSelectFacade = create SCC_POP_SELECT:MODEL:PopSelectFacade({State


Record}.SCCPS_TOOL_ID, {State Record}.SCCPS_CNTXT_ID, {State Record}.OPRID, {State
Record}.RUN_CNTL_ID, {State Record}.PROCESS_INSTANCE);

/* Set the Query Name and file location */


&PopSelectFacade.QueryName = {State Record}.SCCPS_QUERY_NAME;
&PopSelectFacade.AttachmentSystemFileName = {State Record}.ATTACHSYSFILENAME;
&PopSelectFacade.FilePath = {State Record}.SCCPS_FILE_PATH;

/* Get the parm data if there is any*/


&PopSelectFacade.GetParmData();

/* Run Pop Select to a Record (e.g. SQL table)*/


&PopSelectFacade.ExecuteToRecord();
Set up a Population Selection context for this component

Você também pode gostar