The transformCurrentRow method plays a central role in a typical Business to Business interaction. This page looks at the Business to Business example in greater detail. The following diagram illustrates:click to review row processing

  1. Partner order. An order is received from a partner.
  2. Business logic. API Creator invokes business logic to process the order.
  3. ShipperAPIDef. A message to a shipper.
For more information about the Business to Business example, see Business to Business Example.

Key Background

The following sections show this is accomplished with two custom resources and a few lines of code. The following are the underlying concepts that make this possible:

  • Row processing, particularly resource/object mapping, and logic.
For more information about row processing, see Row Objects.
  • transformCurrentRow, which creates a resource instance (string) from a table row.
For more information about custom resources, see Customize your API.

Partner Order

We define the PartnerOrder custom resource as shown in the following image. The custom resource contains multiple tables and the columns we want are chosen/renamed:

Business Logic

As a part of row processing, API Creator finds the relevant logic. For this transaction, the logic includes the event noted in the following images:


In the code shown in the previous image, ShipperAPIDef is yet another resource. Similar to the other custom resource, it defines what tables we want, what attributes, and how they are renamed. This is the "shape" of the POST we want to send to our shipper.

The transformCurrentRow method takes the current Order row (contained in logicContext) and creates an instance of it per the ShipperAPIDef resource. So, as for the incoming PartnerOrder, custom resources define the mapping and transformation logic. The next line sends it to the address maintained in the shipper row.

transformCurrentRow operation

Since the method is for logicContext, the system has access to the (table) row.  It uses this (and associated meta data) to perform a resourceGet on the designated resource, by supplying the primary key from the row.  

The resourceGet performs the mapping and transformation logic noted above.  Observe there may be little or no correlation between table rows and the resource definition.