Adv Find & Replace not working

Viewing 3 reply threads
  • Author
    Posts
  • December 11, 2020 at 7:22 PM #42830

    Chris Klein
    Participant

    I have a checkbox field called Tonight! in my astronomy form.

    If I want to view this object tonight, I’ll check the box on so that all objects with a check will show up in a list I’ll use tonight with my telescope.

    Tomorrow, however, I want to use Advanced Find and Replace to uncheck all the Tonight! boxes so I can make a new observing list.

    The Advanced Find & Replace doesn’t seem to work on the checkbox.

    I’ve tried these combos:
    Yes No
    True False
    1 0

    None of them turn the checkbox fields from checked to unchecked.

    Any suggestions?

    December 13, 2020 at 9:10 PM #42842

    Brendan
    Keymaster

    Hi Chris,

    You’re right. It’s not working right for checkmark field types. I’m working on fixing that. In fact, I just fixed it (for the next update).

    In the meantime, you can write a Form Script to accomplish the same thing that loops through the records, looking for the checkmark field value and turning it off if it’s on.

    Are you familiar with scripts in Tap Forms yet? Here’s a sample bit of code that will do that for you, but you’d have to put your own Checkmark field’s ID in it:

    function Toggle_Checkmark() {
       var records = form.getRecords();
       var check_mark_id = 'fld-f14ccd51913b4348b2c32d9ac4eaf7f2';
    
       for (var index = 0, count = records.length; index < count; index++){
    	// do something;
    	var record = records[index];
    	var value = record.getFieldValue(check_mark_id);
    	if (value == true) {
    		record.setFieldValue(check_mark_id, 0);
    	}
       }
       form.saveAllChanges();
    }
    
    Toggle_Checkmark();

    Thanks,

    Brendan

    December 13, 2020 at 9:11 PM #42843

    Brendan
    Keymaster

    Oh, and internally a Checkmark field uses 0 or 1. But initially they are empty, so they have no value (aka null).

    December 18, 2020 at 10:20 PM #42902

    Chris Klein
    Participant

    Thanks Brendan! Works perfectly!

Viewing 3 reply threads

You must be logged in to reply to this topic.