---
title: "Filtering on fields from the Twinfield API"
language: en
source_language: nl
translation_state: complete
canonical: https://documentation.invantive.eu/en/forum/1113/filteren-op-velden-uit-de-twinfield-api
original: https://documentation.invantive.eu/nl/forum/1113/filteren-op-velden-uit-de-twinfield-api
updated: 2026-11-28T11:50:32Z
license: https://documentation.invantive.eu/en/
---

# Filtering on fields from the Twinfield API

This topic provides information on how to use Invantive SQL to limit the amount of data retrieved from the Twinfield (SOAP) API.

Twinfield administrations sometimes contain a lot of financial data. Via the Twinfield API, enormous amounts of data in 1x can be requested, which also come back in 1x. Outliers of more than a gigabyte of data (uncompressed) in 1 response to a request are not unusual.

#### Three Twinfield API groups: `ProcessXML`, `Finder` and `BudgetService.svc`

Invantive's [Twinfield SQL driver](https://go.invantive.eu/datamodels/twinfield) accesses the Twinfield API server via three channels:

- The financial data is "transaction data" and is offered via the `processxml` service URL.
- The tables with relatively little data are offered via the `finder` service URL.
- Budget information is available via the `BudgetService.svc` service URL.

Filtering is not possible for the tables based on the `finder` service URL and the budget information. That does not need to be a problem, since it concerns relatively small amounts of data. Only for the APIs behind the `ProcessXML` service URL does Invantive SQL offer filter options.

The `processxml` API group can be recognized by the service URL containing the value `webservices/processxml.asmx`, but it is more intuitive to ask yourself whether many rows can be returned and whether the rows change when transactions are processed? If the answer to both is yes, then it will be a table from the `processxml` API group.

#### Filters

Given the large volumes of data, it is useful and sensible in SQL queries to include filters so that:

- the Twinfield API server has to do as little work as possible to select the data in the administration,
- the financial data comes back quickly and
- the network is not overloaded.

In the SQL code, filters can be included after `where` that limit the amount of data, such as all bookings in period 4 of 2019:

```
select *
from   generalledgerdetails
where  FIN_TRS_HEAD_YEARPERIOD = '2019/04'
```

#### Forwarding Filter to Twinfield API Server

Not every filter is forwarded to Twinfield: the query above on [`GeneralLedgerDetails`](https://go.invantive.eu/datamodels/twinfield) does use a filter on year/period, as visible when retrieving via [`SessionIOs@DataDictionary`](https://documentation.invantive.eu/datamodels/datadictionary/DataDictionary.Invantive.SESSIONIOS):

[![Filters used on Twinfield API](/img/ee9e72bfded5cf586d67ef2403f006d77c8cbb9b4be87edfa97f83309e53d16d/690x302.png)](https://forums.invantive.com/uploads/db9863/original/1X/0f4e4b2299aaa3d86498f5da8b151a7aa4ce4195.png)

But the functionally identical query:

```
select *
from   generalledgerdetails
where  fin_trs_head_year = 2019
and    fin_trs_head_period = 4
```

does not use filters, so first *all* documents must be retrieved and filtered locally:

[![Twinfield query without filter](/img/b2e6f548fa346fe62ce18472ea73851adf47f2b5d43ecbd7df4e48bea78dc42c/675x326.png)](https://forums.invantive.com/uploads/db9863/original/1X/de507edb7e2b170743eeeee6c0a90c89d6a3bc6e.png)

Invantive SQL itself determines which filters, possibly after a transformation, can be forwarded to the Twinfield API servers. This is called “server-side filtering”. More information on this can be found in [How to filter data from OData query on Azure Data Factory? - 3 from forums](https://forums.invantive.com/t/how-to-filter-data-from-odata-query-on-azure-data-factory/610/3).

On most platforms, server-side filtering works automatically because it is hardcoded in the code or the metadata specifies which fields can be filtered. For Twinfield, the current Invantive implementation of server-side filtering is impractical because Twinfield does indeed state through the metadata which server-side filters are possible, but also specifies which operator (equals, between values) must be used.

The supported filters can be found in the contents of the Twinfield metadata table `TableColumnSpecifications`:

[![Twinfield browser filters](/img/f0dcc8f6151d86552985b871113b6fb5439abf1c8487c0c5d71252ccf69f5661/974x577.png)](https://forums.invantive.com/uploads/db9863/original/1X/0fc636af2bfc8ead0edd0a3f52c14145882b50ad.png)

Here, for example, it can be read that a filter with a `between` can be used for `BankTransactions` on the field `fin_trs_head_yearperiod`.

The Twinfield online documentation also contains the list of fields that can be filtered faster, such as the field `FIN_TRS_HEAD_NUMBER` with a `between`, `>=`, `>`, `=`, `<` or `<=`:

<div class="onebox">

[CashTransactions (Twinfield)](https://documentation.invantive.eu/en/datamodels/twinfield/Twinfield.Twinfield.CashTransactions)

Cash Transactions

documentation.invantive.eu

</div>

#### Rewrite Query

Invantive SQL is smart enough to also translate the Invantive SQL equality operator for Twinfield into a Twinfield `between`, so for example a query such as:

```
select *
from   banktransactions
where  fin_trs_head_yearperiod = '2019/01'
```

uses a Twinfield `between` filter operator on `fin_trs_head_yearperiod`. This can also be read in `SessionIOs@DataDictionary`, where the Invantive notation is shown:

```
FIN_TRS_HEAD_YEARPERIOD Equals 2019/01, fin.trs.head.banktype equal bank
```

More details can also be found in the trace, as explained in [How do I get trace files again from an automated download with Data Hub? - 2 from forums](https://forums.invantive.com/t/hoe-krijg-ik-weer-trace-files-van-een-geautomatiseerde-download-met-data-hub/295/2). The native call log shows all details as described in [Collect Native Platform Call Data](https://forums.invantive.com/t/collect-native-platform-call-data/227).

#### Summary

Even large to very large Twinfield administrations can easily be processed in Invantive SQL or replicated to a database by formulating the right filters in an Invantive SQL where clause.

---

Source: [https://forums.invantive.eu/t/filteren-op-velden-uit-de-twinfield-api/1113](https://forums.invantive.eu/t/filteren-op-velden-uit-de-twinfield-api/1113)
