thumb_up
thumb_down
link
Copy link
Copied
insert_emoticon
lmatfy
Copied
XML filter for GetConnector

When you call a GetConnector, you can enter a filter (in XML format). As this filter can be different for each call, we call it a variable filter.

By using a filter, you limit the number of records retrieved. If the number of records is still too high, use the 'GetDataWithOptions' option.

Note:

To be able to test this, you must first add an App connector.

Link the GetConnector that you want to test to the App connector.

After you have linked a user group to the App connector, you create a token for one of the users of this user group. You need this token for calling the GetConnector.

Contents

Structure of the filter XML

The filter XML is structured as follows:

App_Conn GS Lokaal GetConnector - Filter - XML - Simple

Components of a filter:

  • FilterId: sequence number. If you create a filter in Profit, the FilterId of the first filter is 'Filter 1'. The subsequent filters are numbered consecutively.
  • FieldId: the field name in the GetConnector.
  • Operatortype: the filter type, according to the list below.

    Operator

    Operation

    Example with the value 'NL' (only the filter line is listed)

    1

    is equal to

    <Field FieldId="CoId" OperatorType="1">NL</Field>

    2

    is bigger or equal to

    <Field FieldId="CoId" OperatorType="2">NL</Field>

    3

    is smaller or equal to

    <Field FieldId="CoId" OperatorType="3">NL</Field>

    4

    is bigger than

    <Field FieldId="CoId" OperatorType="4">NL</Field>

    5

    is smaller than

    <Field FieldId="CoId" OperatorType="5">NL</Field>

    6

    text exists in field

    <Field FieldId="CoId" OperatorType="6">%NL%</Field>

    7

    Option 1:

    Is not equal to

    Precise comparison of two values:

    <Field FieldId="CoId" OperatorType="7">NL</Field>

    7

    Option 2:

    Text is not present in field

    Check whether a value appears in a field:

    <Field FieldId="CoId" OperatorType="7">%NL%</Field>

    8

    field is blank

    For this filter, you only specify the operator.

    <Field FieldId="CoId" OperatorType="8" />

    9

    field is not blank

    For this filter, you only specify the operator.

    <Field FieldId="CoId" OperatorType="9" />

     

    10

    field starts with text

    <Field FieldId="CoId" OperatorType="10">NL%</Field>

    11

    text not exists in field

    <Field FieldId="CoId" OperatorType="11">%NL%</Field>

    12

    field not starts with text

    <Field FieldId="CoId" OperatorType="12">NL%</Field>

     

    13

    field ends with text

    <Field FieldId="CoId" OperatorType="13">%NL</Field>

    14

    field not ends with text

    <Field FieldId="CoId" OperatorType="14">%NL</Field>

     

For OperatorTypes 6, 10, 11 and 12, you must use wildcards, such as "A%" (starts [or does not start] with A) or "%A%" (contains [or does not contain] A).

For operator type 15, you can also use Profit filter criteria (see the examples).

Note:

Configure the filter as efficiently as possible. Use operator type 1 = Equal to. Where possible, filter by key fields.

It is not allowed to use tags like [today]. This is because these tags do not apply in XML.

You can enter multiple filters. The following applies here:

  • AND filter

    For an AND filter, all conditions must be met. You put all filter lines in a single filter.

  • OR filter

    For an OR filter, at least one condition must be met. You put the filter lines in different filters.

To add an AND filter:

In this example you filter by period 1 of the current financial year. The employee cannot be blocked.

  1. Select the GetConnector.
  2. Click on the action: Run.
  3. Record the filter.
  4. Click on: XML Filter.

    App_Conn GS GetConnector - Filter - XML (10 structuur) - EN-filter

    In the filter XML, you use 'True' and 'False' instead of 'Yes' and 'No'.

To add an OR filter:

In this example you filter by today's or tomorrow's date. You cannot use tags here, such as [today]. This is because these tags do not apply in XML.

App_Conn GS GetConnector - Filter - XML (10 structuur) - EN-filter

In the filter XML, you use the format yyyy-mm-ddThh:mm:ss for a date.

Example:

So you enter a filter for 13:30 on 18 December 2017 as follows:

2017-12-18T13:30:00.

Examples

Examples:

  • Yes/No field: true or false
  • Decimal field: 15.5
  • Date, time or date-time field: 2017-08-17T16:32:32

Examples: XML filters

All lines for which the 'Blocked' field has been deselected:

<Filters>
<Filter FilterId="Filter1">
<Field FieldId="Geblokkeerd" OperatorType="1">false</Field>
</Filter>
</Filters>

All lines for which the Country field is equal to 'NL':

<Filters>
<Filter FilterId="Filter1">
<Field FieldId="Land" OperatorType="1">NL</Field>
</Filter>
</Filters>

All lines for which the 'Naam' field is not completed or contains the text 'unknown':

<Filters>
<Filter FilterId="Filter1">
<Field FieldId="Naam" OperatorType="8" />
</Filter>
<Filter FilterId="Filter2">
<Field FieldId="Naam" OperatorType="6">%unknown%</Field>
</Filter>
</Filters>

Example: Quick filter criteria

In this example, a filter is applied based on the quick filter tag @ (Field begins with).

<Filters>

    <Filter FilterId="Filter 1">

        <Field FieldId="CoId" OperatorType="15">@nl</Field>

    </Filter>

</Filters>

Create an XML filter

You create an example of the filter XML in the GetConnector in Profit. This is just a way to create a filter XML; this filter is not saved in Profit. You can, however, copy the filter and use it in the call via the Profit Web services.

To add and test a variable filter:

  1. Go to: General / Output / Management / GetConnector.
  2. Select the GetConnector.
  3. Click on: Run.
  4. Specify a filter.

    App_Conn GS Lokaal GetConnector - Filter - XML (30 proc) - Profit

  5. Click on: XML Filter.
  6. The XML appears in a window:

  7. Right-click in the window and click on the 'View Source' option.

    A new window is displayed with the entire code as one long string (without returns/line breaks). This is the string you need.

  8. Continue with one of the below procedures (for a local installation of AFAS Online). Now Small Business can only be used in combination with AFAS Online.
Test the XML filter (local installation)
  1. Open your browser.
  2. Go to the following URL:

    http://localhost/Profitservices/appconnectorget.asmx

  3. Enter the token.
  4. Enter the name of the GetConnector.
  5. Selecteer de hele filter-string en kopieer deze naar het Klembord.

    App_Conn GS Lokaal GetConnector - Filter - XML (30 proc) - Profit

  6. Keer terug naar je browser. Als het tabblad met de vorige aanroep nog geopend is, hoef je alleen het filter in te vullen. zo niet, dan moet je eerst de app connector aanroepen met de URL http://localhost/Profitservices/appconnectorget.asmx en de gegevens invullen.
  7. Plak de filter-XML bij 'filtersXml'.

  8. Gebruik de waarde -1 bij de velden skip en take. Je kunt deze velden gebruiken om de op te halen records in te delen in pakketjes.
  9. Click on: 'Invoke'.
Test an XML filter (AFAS Online)

Use one of the following methods to test a GetConnector:

Directly to

  1. Apply a filter in a GetConnector
  2. Fixed filter in Profit
  3. Variable filter in XML

Process

GetConnector

Work area

connector