Example to populate datafield from a migrate process

Created on 19 August 2024, about 1 month ago
Updated 23 August 2024, about 1 month ago

I tried to populate a multiple datafield from a migrate process

Do you have an example to populate the data of a multiple datafield from migrate? I tried to use the 'sub_process' plugin for this without success.

Here is my config :

  # Populate fields.
  field_datas:
    plugin: sub_process
    source: external_datas
    process:
      field_datas_name: data/name
      field_datas_id: data/no
      field_datas_type: data/type

'name', 'id' and 'type' are the system names of the subfields.

Here is the structured external datas :

Array
(
    [external_datas] => Array
        (
            [0] => Array
                (
                    [data] => Array
                        (
                            [no] => 456
                            [type] => AA
                            [name] => Name 1
                        )

                )

            [1] => Array
                (
                    [data] => Array
                        (
                            [no] => 123
                            [type] => BB
                            [name] => Name 2
                        )

                )

        )

)

I get no error on the migrate process, but my data field isn't populated.

Thanks for your help.

💬 Support request
Status

Closed: works as designed

Version

2.0

Component

Code

Created by

🇫🇷France kumkum29

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @kumkum29
  • Status changed to Closed: works as designed about 1 month ago
  • 🇫🇷France lazzyvn paris

    no data it just array

    [
    [
    no => 456
    type => AA
    name => Name 1
    ],
    [
    no => 123
    type => BB
    name => Name 2
    ]
    ]
  • 🇫🇷France kumkum29

    Hello,

    The names of the subfields were wrong. With this code it's ok ;)

      field_datas:
        plugin: sub_process
        source: external_datas
        process:
          name: data/name
          id: data/no
          type: data/type
Production build 0.71.5 2024