To use datasets in a distributed environment, you pass a dataset as a parameter from one procedure to another or between a server and a client. The ability to pass a dataset as a parameter is the foundation for building distributed applications.

One of the most powerful features of a dataset is its ability to be transported or “marshaled” between client and server procedures. The following illustration shows steps on the client and server sides for defining, building, updating and cleaning up a dataset.

The most common reason for passing a dataset as a parameter is the “round-trip” scenario:

  1. A client requests a dataset from the server by calling a procedure in the server, which populates the dataset and returns the dataset as a parameter to the client.
  2. The client makes changes to the data in the retrieved dataset.
  3. The client passes the changes to the server as a parameter by calling a procedure in the server, which applies the changes to the database and returns the result of the changes to the client.
  4. The client reconciles the changes in its copy of the dataset.

Pass a dataset

When you develop your ABL application, plan for how a dataset is used within the ABL session and between ABL sessions. The server-side code may have multiple procedures that are used to process a client request for a dataset. For example, the client may call GetData which formats the query used to populate the dataset. GetData then calls PopulateData, which fills the dataset and returns the dataset to GetData. Finally, GetData returns the dataset to the client.

When passing a dataset between procedures in the same session, it is a good practice to ensure that the dataset is passed by reference. This practice ensures all routines are working on the exact same dataset, rather than copying the data from one instance of the dataset to another.

When the dataset is passed between the client and server (between different ABL sessions), the dataset must be passed by value.

See also

Pass a ProDataSet as a parameter