About EasyMorph Tutorials & Examples Web-help

Export Boolean to SQL


#1

Hello,

I am trying to export boolean data into an SQL server.
During the export, I run into this error message:

Export of row #0 failed with the following error: Column [enabled] contains a value which is not compatible with the Boolean data type Source.

My data are hosted with True / False.
What can I do in order to be able to export this column?

Thanks in advance for your advice.


#2

Hello,

It seems that you True / False values are stored as text and not as booleans. But only boolean cells can be exported to boolean database column. You can check actual type of a value by opening right click menu of a cell and choosing “Metadata” menu item.

You can convert them to actual booleans with the “Modify column” action and one of the following expressions.

If you sure that all the values in the column contain either ‘True’ or ‘False’:

[Bool] = 'True'

If you want to check data quality:

if([Bool] = 'True' or [Bool] = 'False', [Bool] = 'True', error("Value '" & [Bool] & "' can't be converted to boolean"))


#3

Good point. I was not aware about the Metadata feature. This is very helpfull.

So I confirm my data are hosted in Text format.
How can I transfrom the text to a boolean value?

All my data are comming from a CSV file.

Thanks for your help.


#4

Add “Modify column” action with one of the expressions which I mentioned above.


#5

Hello,

Thanks for your reply. I’m sorry, I have tested several times but I’m still stuck with converting my text value to Boolean.

Could you please detail me how can I do this kind of transformation.

Thanks,


#6

Here is an example project:

ConvertBooleansFromText.morph (2.5 KB)


#7

Excellent.
Thank you.