Skip to content

Fields present

natlibfi-arlehiko edited this page Jun 10, 2019 · 3 revisions

Description

Check whether the configured fields are present in the record.

Configuration

An array of field tag patterns

Example

[/^008$/, /^245$/]

Record examples

Example 1

Config

[/^1..$/, /^FOO$/]

Valid record

{
  "fields": [
    {
      "tag": "001",
      "value": "123456"
    },
    {
      "tag": "110",
      "subfields": [
        {
          "code": "a",
          "value": "foobar"
        }
      ]
    },
    {
      "tag": "FOO",
      "subfields": [
        {
          "code": "a",
          "value": "foo"
        }
      ]
    }
  ]
}

Invalid record

{
  "fields": [
    {
      "tag": "001",
      "value": "123456"
    },
    {
      "tag": "101",
      "subfields": [
        {
          "code": "a",
          "value": "foobar"
        }
      ]
    },
    {
      "tag": "BAR",
      "subfields": [
        {
          "code": "a",
          "value": "foo"
        }
      ]
    }
  ]
}

Example 2

Config

[/^50.$/]

Valid record

{
  "fields": [
    {
      "tag": "001",
      "value": "123456"
    },
    {
      "tag": "500",
      "subfields": [
        {
          "code": "a",
          "value": "foo"
        }
      ]
    },
    {
      "tag": "550",
      "subfields": [
        {
          "code": "a",
          "value": "bar"
        }
      ]
    }
  ]
}

Invalid record

{
  "fields": [
    {
      "tag": "001",
      "value": "123456"
    },
    {
      "tag": "510",
      "subfields": [
        {
          "code": "a",
          "value": "foo"
        }
      ]
    },
    {
      "tag": "550",
      "subfields": [
        {
          "code": "a",
          "value": "bar"
        }
      ]
    }
  ]
}

Example 3

Config

[/^(020|022|024)$/]

Valid record

{
  "fields": [
    {
      "tag": "001",
      "value": "123456"
    },
    {
      "tag": "020",
      "subfields": [
        {
          "code": "a",
          "value": "978-3-16-148410-0"
        }
      ]
    },
    {
      "tag": "550",
      "subfields": [
        {
          "code": "a",
          "value": "bar"
        }
      ]
    }
  ]
}

Invalid record

{
  "fields": [
    {
      "tag": "001",
      "value": "123456"
    },
    {
      "tag": "550",
      "subfields": [
        {
          "code": "a",
          "value": "bar"
        }
      ]
    }
  ]
}