Fetch Object Instance

Fetch Instance from the database

Fetch Instance

This action fetches an object instance from the database which becomes the value of this action.

The fetch instance action needs to know which instance you want.

We describe this by

  • thinking of which instances we might want to consider (= defining filter conditions)
  • then thinking how we might sort that collection of instances so that the one we want is first.

In fact, there are three steps to configuring the fetch, and they appear in this order:

  1. You specify how to sort the objects 2.Then you say which you want to pick from the sorted list (normally the first, but you might want second, third etc)
  2. You can also add field conditions to narrow down the selection to a specific collection

Example

Suppose we needed to

Fetch the invoice with the largest amount from the past 12 months

you would configure it like this:

  1. sort by the amount field
  2. pick the first instance from the sorted list
  3. and add a field condition on invoice date so that list you are picking the instance from contains only invoices from past 12 months

Fetch Specific Instance

If you know the primary key of the instance you want to fetch from the database, you configure like this:

  1. choose to sort by any field
  2. pick the first instance from the sorted list
  3. set a field condition on the unique field, specifying that the value of that field must include