Import Yes/No answers for checkbox

Viewing 6 reply threads
  • Author
    Posts
  • June 13, 2020 at 6:01 AM #40940

    Kimberley Hoffman
    Participant

    HI Brendan,

    I’m working on a new search and find book again. But due to Corona, I cannot meet the people I am drawing into it, which is why I have a an online registration form that I built using Sendinblue.

    For some of the answers on the form there are categories that return “yes” or “no” (radio buttons)
    I have been able to import much of the data as csv. data, but am having difficulty figuring how the “yes/no” answers should be imported. I thought a checkbox would work, but it doesn’t. A test of four participants leaves the box empty, even though they returned the answer “yes”.

    Before I add the rest of the particpants, it would be nice if I could find a better way.

    What type of field should I be using for that kind of data in Tap Forms? Thanks.

    Regards,
    Kimberley

    June 13, 2020 at 9:06 AM #40941

    Daniel Leu
    Participant

    I see two different options:

    1. replace ‘yes’ and ‘no’ with ‘1’ and ‘0’ in your csv and then import these fields as checkbox fields.
    2. import ‘yes’/’no’ fields as text field and then use a script field to translate it into ‘1’/’0′ of a checkbox field

    I don’t use imports often, so there might be another option.

    June 13, 2020 at 11:08 AM #40944

    Kimberley Hoffman
    Participant

    I am trying to avoid replacements, so I don’t accidently erase data. Some of the fields are GDPR fields and they need to be kept. And truthfully, I have no idea on how to write a script.

    But maybe just changing the fields to text fields would be the easiest?

    June 13, 2020 at 12:44 PM #40946

    Daniel Leu
    Participant

    If you want to have checkboxes, following script sets a checkbox based on the ‘yes/no’ field:

    function Yes_No_Script() {
    
    	const check_mark_id = 'fld-xxx';
    	const yes_no_id = 'fld-xxx';
    
    	if (record.getFieldValue(yes_no_id) == 'Yes'){
    		record.setFieldValue(check_mark_id, 1);
    	} else {
    		record.setFieldValue(check_mark_id, 0);
    	}
    	form.saveAllChanges();
    }
    
    Yes_No_Script();

    This is a field script. If you change the checkbox value, it is overwritten by this script. That’s something that could be changed, but I wanted to keep it simple to start with.

    The only thing you need to change are the two ids.

    June 14, 2020 at 1:10 AM #40948

    Brendan
    Keymaster

    y, yes, t, true, and 1 should all be accepted when importing from a CSV file into a Checkmark field. Anything else will assume to be no.

    Make sure the field type is specified as a Checkmark field before the import on the Import Records screen.

    June 14, 2020 at 8:37 AM #40951

    Kimberley Hoffman
    Participant

    Thanks everybody. I’ll test it again. The registrations are piling up. (Yay!)
    Regards,
    Kimberley

    June 14, 2020 at 9:02 AM #40952

    Kimberley Hoffman
    Participant

    This time it worked. Thanks again!

Viewing 6 reply threads

You must be logged in to reply to this topic.