riasvdv / statamic-data-import

MIT License
14 stars 8 forks source link

Boolean fields imported as strings #15

Closed wesort closed 2 years ago

wesort commented 2 years ago

Importing a CSV with "false" for boolean fields results in "true" toggles in the CP. Tested with both the words "false" and "FALSE" and both end up with the field being true in the CMS (e.g. toggle set to green).

Example using false

blueprint,is_hidden,title,description
stills,false,_Import test,Writing with some 'semi' rich text
---
id: 3078d502-9326-4c9d-b93c-b28594de33a7
blueprint: stills
is_hidden: 'false'
title: '_Import test'
description: 'Writing with some ''semi'' rich text'
---

Example using 0 (zero)

NB: Functions as a workaround _NB: This results a false toggle in the CP (e.g. toggle not set to green) but it's still a string on disk. Saving the entry in the CP changes the string to a boolean (ie: field_name: '0' becomes field_name: false)._

blueprint,is_hidden,title,description
stills,0,_Import test,Writing with some 'semi' rich text
---
id: eb41103d-14c0-412a-b641-a49178fc1e8e
blueprint: stills
is_hidden: '0'
title: '_Import test'
description: 'Writing with some ''semi'' rich text'
---