Jeffrey Semmens · May 5, 2016

Using Snapshots in BPL

I have a scenario where I am calling a business operation which populates  and returns an EnsLib.SQL.Snapshot via dynamic SQL to a Business Process. I then want to iterate over this snapshot and call a RecordMap Operation to write those records to a delimited file.

Is this the correct way to do something like this? If so, does anyone have a sample which illustrates its correct usage?

When the snapshot is returned I save it into a context variable with:

set context.Snapshot=callresponse where the pOutput variable of the operation is set to EnsLib.SQL.Snapshot.

Would I then use a While block where the condition is context.Snapshot.Next() ? This seems to give an error.

If anyone has an alternate way of doing this I would appreciate it. Right now my alternate way is to return a JSON string generated by populating some dynamic objects (2016.2), then calling some code in the BPL to convert the string back to dynamic objects with $fromJSON() and then call an operation. But this is very code heavy and I only did it this way because I was trying to make use of the new %Object and %Array constructs.

2 0 1 480
Log in or sign up to continue

I figured out my mistake. My solution works like a charm now.  The operation returns a snapshot which I iterate through with a BPL While (Condition= context.MySnap.Next()), and within the while I then call the context.MySnap.GetData(1), etc. Populate the request to the RecordMapper can call the operation.