"The filter is not valid for the field" when excluding a range
Symptom
Section titled “Symptom”An outgoing object stops sending and the entries in Web Connect Entries fail with an error like:
The filter 4000..4999&<>4620&<>402001..403601 is not valid for the field G/L Account No.
The filter is usually set as a Filter String on a table relation line, or in the Outgoing Sync Table View of a web object.
In Business Central, <> (not equal to) only works with a single value. It cannot be combined with a range.
| Filter | Valid? |
|---|---|
4000..4999&<>4620 |
Yes |
4000..4999&<>402001..403601 |
No |
One invalid part makes the whole filter invalid, so nothing is sent.
How to Fix It
Section titled “How to Fix It”Write the filter as the values that should be included, instead of the values that should be excluded. Separate the ranges with | (or).
Example: include accounts in the 4000 series, but exclude 402001..403601:
4000..402000|403602..4999A simpler and more robust alternative is to list only the accounts or ranges you actually want, for example 401001..401601|404001|421602..429601.
Number fields that are text
Section titled “Number fields that are text”Account numbers and other Code fields are compared as text, not as numbers. 4000..4999 therefore also includes six digit accounts such as 402001 and 421701, because they start with “40” and “42”. Keep this in mind when you set the range limits.
Test before you save
Section titled “Test before you save”- Open the list in Business Central that matches the table, for example General Ledger Entries.
- Paste the new filter in the column filter for the field.
- Check that exactly the expected records are shown.
Only then save the filter in Web Connect.
Before You Save the Corrected Filter
Section titled “Before You Save the Corrected Filter”While the filter was invalid, every triggered record failed and is waiting in Web Connect Entries. When the filter becomes valid, all of them are sent at once. This can include records that should never have been sent.
- Open Web Connect Entries for the object and filter on entries with an error.
- Check what is waiting. Remove or close entries that should not be sent.
- Make sure the object only picks up the right records (see Outgoing Sync Triggers and the Outgoing Sync Table View on the web object).
- Save the corrected filter.
If you are unsure, contact us before saving the filter in a production environment.
