Page 1 of 1

How to Import Checkbox fields

PostPosted: Thu Sep 24, 2009 10:28 am
by Shepherd Jim
I'm back with another import/export problem: (HDB 4.1.6 on a Palm Centro smartphone, HDB Desktop 4.1.5 on PC/XP)

I export a database/table from Alpha Five (Ver 8) to a text .csv file. Three "logical" fields have "T"s and "F"s in them. The "T"s and "F"s show correctly in both a listing in Alpha Five and the .csv file viewed in Excel.

I then import the .csv into an existing HDB .pdb database where those three fields are "Checkboxes", and ALL the boxes are checked -- meaning that, effectively, all the "F"s have become "T"s.

Is there an simple way to avoid this? I'm guessing that if I went into the database in Excel and replaced all the "F"s with blanks " "s and THEN imported, the resulting "false" checkboxes would be UNchecked?

Jim

Re: How to Import Checkbox fields

PostPosted: Thu Sep 24, 2009 11:43 am
by dhaupert
Shepherd Jim wrote:I'm back with another import/export problem: (HDB 4.1.6 on a Palm Centro smartphone, HDB Desktop 4.1.5 on PC/XP)

I export a database/table from Alpha Five (Ver 8) to a text .csv file. Three "logical" fields have "T"s and "F"s in them. The "T"s and "F"s show correctly in both a listing in Alpha Five and the .csv file viewed in Excel.

I then import the .csv into an existing HDB .pdb database where those three fields are "Checkboxes", and ALL the boxes are checked -- meaning that, effectively, all the "F"s have become "T"s.

Is there an simple way to avoid this? I'm guessing that if I went into the database in Excel and replaced all the "F"s with blanks " "s and THEN imported, the resulting "false" checkboxes would be UNchecked?

Jim


Hi Jim,

Good question. When a CSV is imported, anything other than a blank value or a zero value is treated as checked. So you have a few options to get that data in there then.

You could do as you mentioned- do a search and replace to change it on the Alpha Five side.
You could import as a text field in HanDBase and then add a conditional field that says if the text field is F the value is 0, otherwise, it's 1. Then after setting that field up and the program recalculated, you can convert the conditional to a checkbox and get the right values.

Hope one of these work for you!

Re: How to Import Checkbox fields

PostPosted: Wed Nov 28, 2012 11:57 pm
by idamtnboy
dhaupert wrote:
Hi Jim,

Good question. When a CSV is imported, anything other than a blank value or a zero value is treated as checked.

Has something changed since you wrote this, or did you get it wrong? I just did an import with checkbox fields. The csv file had -1 for the checked values, and blank for unchecked. All the blank values imported as checked resulting in all the boxes in the HB db being checked. I went into the csv file and changed all the blank values to zero and then they imported as unchecked.

Re: How to Import Checkbox fields

PostPosted: Thu Nov 29, 2012 7:40 am
by dhaupert
I honestly don't remember changing that, but it is an almost 4 year old post, so a lot has happened since then! It sounds like the program is specifically looking for a 0 for unchecked to me.

Re: How to Import Checkbox fields

PostPosted: Sun Dec 02, 2012 10:35 am
by Brian_Houghton
If I remember correctly 1 will set the checkbox and 0 will leave it unchecked.
Not sure when this change was made, but in my last testing of this feature it seems this was the case.