Using the Business Entity method FetchDataByKeyTable

Introduction

FetchDataByKeyTable is an internal method within the Smart Component Library Business Entity, that provides the user with a mechanism to retrieve multiple specific Database records based on a temp table with the values of the fields composing a (unique) key.

One purpose of the FetchDataByKeyTable method is to remove the unnecessary building of a large Query String composed by OR'ing a large list of key values that potentially could exceed the 32K size limit.

 

FetchDataByKeyTable

The method FetchDataByKeyTable is implemented as an Invokable Method and requires the two usual parameters Dataset Handle and a  parameter object that implements the IFetchDataByKeyTableParameter interface.

The IFetchDataByKeyTableParameter Object

 The IFetchDataByKeyTableParameter parameter object contains two properties allowing PUBLIC GET access.

Property Name
Description
TablesThis property is used to return a comma delimited list of Tables
KeyValueTableHandleThis property is used to return the handle of the temp-table containing the key values


The FetchDataByKeyTable Method expects an object that exposes a temp-table containing a single record per key-value combination. Internally, the Default Query for your Business Entity subsequently performs a Join using the ‘Object’ to return only the records matching those specified within the temp-table.

The Dataset Handle

The Dataset Handle should be a reference to the returned Dataset containing the results.


Example Usage

Outlined below is an example on how to implement the FetchDataByKeyTable Method. The example shall be based on a OrderLine Business Entity.

First, we shall need to create an appropriate Parameter Object Class relevant to the Business Entity in hand.

 

 

With the Parameter Object defined, we can now populate the Parameter Object with the desired Key values and subsequently Invoke the FetchDataByKeyTable Method passing in the appropriate parameters.


 

As the Interface IFetchDataByKeyTableRequest extends the IFetchDataByKeyTableParameter interface, objects implementing this interface can be passed whenever an IFetchDataByKeyTableParameter object is supported as well, e.g.: