riasvdv / statamic-data-import

MIT License
14 stars 8 forks source link

Fields that expect an array get null (rather than left blank) when given empty content. #16

Closed wesort closed 2 years ago

wesort commented 2 years ago

An empty 'cell' in the .csv import for a related_film column (fieldtype: entries) will create an array with null.

related_film:
  - null

The expected result should be the field is skipped in the import.

The problem with the null is that it breaks (is that the right term??) the field in the CP. null in a entries field

riasvdv commented 2 years ago

Should be fixed in 1.2.1!

wesort commented 2 years ago

Only just getting a chance to test this and unfortunately I'm still seeing the issue.

Example .csv content:

blueprint,title,still_image,related_film,digital_formats
stills,_Test import 01,_test-card-01.png,,jpg|tiff

Resulting .md content file:

---
id: 3099d691-6bdc-4cf6-854f-314488fe60dc
blueprint: stills
title: '_Test import 01'
still_image: _test-card-01.png
related_film:
  - ''
digital_formats:
  - jpg
  - tiff
---

FYI

statamic/cms: v3.3.12 rias/statamic-data-import 1.2.1

Could share a private repo if that helps.

riasvdv commented 2 years ago

The value was "" and not null, so that was causing it, should be fixed in 1.2.2