ProcessRequest Class Methods

In this section, the ProcessRequest class methods are presented in alphabetical order.

Syntax

ProcessRequest(data_model_ID, rulebase_ID, &filters_RS)

Description

When you instantiate a OPA_ADMIN:ProcessRequest object, you automatically invoke the ProcessRequest constructor method. This method initiates an Assess request to the configured OPA Determinations server using the specified data model, rules base, and filters and filter values.

Use PeopleTools-delivered pages to define the data model, entities, filters, and filter operators. Then, at runtime, dynamically provide the filter values in your Application Engine program as shown in the following examples.

Parameters

Field or Control

Definition

data_model_ID

Specifies the ID for the data model as a String value.

rulebase_ID

Specifies the ID for the OPA rule base as a String value.

&filters_RS

Specifies the filters and corresponding filter values as an already instantiated Rowset object based on the OPA_ENT_FILTERS record definition. Each row of this rowset contains four fields:

  • OPA_SEQ_NBR – A Number value corresponding to this field as defined on the Entity - Attributes page.

  • OPA_ENTITY_NAME – A String value corresponding the entity containing this field as defined on the Data Model page.

  • FIELDNAME – A String value representing the name of this field as defined on the Entity - Attributes page.

  • OPA_FILTER_VALUE – The dynamic value for this filter as type Any.

    Note: Specify the filter values in the base language.

Returns

None.

Example 1

In the following example, the TST_RD_ITM_BRAND filter is defined with an Equal To filter operator. Therefore one, and only one, filter value is specified in the rowset:

import OPA_ADMIN:ProcessRequest;

Local Rowset &rsFilters = CreateRowset(Record.OPA_ENT_FILTERS);
&rsFilters.GetRow(1).OPA_ENT_FILTERS.OPA_SEQ_NBR.Value = "1";
&rsFilters.GetRow(1).OPA_ENT_FILTERS.OPA_ENTITY_NAME.Value = "ORDER_ITEM";
&rsFilters.GetRow(1).OPA_ENT_FILTERS.FIELDNAME.Value = "TST_RD_ITM_BRAND";
&rsFilters.GetRow(1).OPA_ENT_FILTERS.OPA_FILTER_VALUE.Value = "Soft Stuff";
&rsFilters.InsertRow(1);

try
   Local OPA_ADMIN:ProcessRequest &processReq = create OPA_ADMIN:ProcessRequest("RD_DATAMODEL", "RetailDiscounts", &rsFilters);
catch Exception &e
   MessageBox(0, "", 0, 0, "Got Exception from OPA Process Request: " | &e.ToString( False));
end-try;

Example 2

In the following example, the TST_RD_OLI_QTY filter is defined with Between filter operator. Therefore two filter values must be specified for this filter in the filter rowset:

import OPA_ADMIN:ProcessRequest;

Local Rowset &rsFilters = CreateRowset(Record.OPA_ENT_FILTERS);
&rsFilters.GetRow(1).OPA_ENT_FILTERS.OPA_SEQ_NBR.Value = "1";
&rsFilters.GetRow(1).OPA_ENT_FILTERS.OPA_ENTITY_NAME.Value = "ORDER_ITEM";
&rsFilters.GetRow(1).OPA_ENT_FILTERS.FIELDNAME.Value = "TST_RD_OLI_QTY";
&rsFilters.GetRow(1).OPA_ENT_FILTERS.OPA_FILTER_VALUE.Value = "50";
&rsFilters.InsertRow(1);

&rsFilters.GetRow(2).OPA_ENT_FILTERS.OPA_SEQ_NBR.Value = "1";
&rsFilters.GetRow(2).OPA_ENT_FILTERS.OPA_ENTITY_NAME.Value = "ORDER_ITEM";
&rsFilters.GetRow(2).OPA_ENT_FILTERS.FIELDNAME.Value = "TST_RD_OLI_QTY";
&rsFilters.GetRow(2).OPA_ENT_FILTERS.OPA_FILTER_VALUE.Value = "250";
&rsFilters.InsertRow(2);

try
   Local OPA_ADMIN:ProcessRequest &processReq = create OPA_ADMIN:ProcessRequest("RD_DATAMODEL", "RetailDiscounts", &rsFilters);
catch Exception &e
   MessageBox(0, "", 0, 0, "Got Exception from OPA Process Request: " | &e.ToString( False));
end-try;