Create Filter: Photo field is empty

Viewing 6 reply threads
  • Author
    Posts
  • July 1, 2020 at 5:03 PM #41141

    Zippidty Doodah
    Participant

    need to create a filter that will pull all records where a photo field named “Cover” is empty.
    When I create a new filter, none of my photo fields is available to choose in the filter drop downs.

    Guidance is appreciated

    July 1, 2020 at 5:14 PM #41142

    Zippidty Doodah
    Participant

    Well it appears someone asked this back in 2017 and there was not a solution then other than awkward work arounds.

    So any hope of getting that added to the filter list?

    Create filter to detect records with no photos

    July 1, 2020 at 5:47 PM #41143

    Sam Moffatt
    Participant

    Another workaround for the list, create a new script field (I called mine “Empty Image Field”), open it up and it’ll drop in a bit of template code for you. If you double click on the image field in your field list on the left, it’ll insert the field ID for the image field. Then if you make the script look something like this, you’ll have a searchable field on if the image field is empty (image_01 is the name of my image field, it’ll like be var cover = ... for you):

    function Empty_Image_Field() {
    	var image_01 = record.getFieldValue('fld-e631165b67374734a3b8f384708b5922');
    	return image_01.length;
    
    }
    
    Empty_Image_Field();
    

    Set it to be a “number” field on the bottom left (default is text) and also tick “update records when saving” to run the script on all of your records. Then hit “Save”, it’ll take a moment for TF to update all of your existing records with the new value for the field (that’ll depend on how many records you have) and then you should be able to look for records that have zero images using the script field and looking for a value of 0.

    July 1, 2020 at 11:45 PM #41145

    Sam Moffatt
    Participant

    I’ve been turning some of the forum replies I do into videos and I took a moment tonight do do this as a video as well. Hopefully it helps you out in getting this working :)

    Also managed to find a bug along the way! The fortunate thing about recording a video is that the exact reproduction steps are there in the video.

    July 2, 2020 at 1:15 AM #41151

    Brendan
    Keymaster

    Great video Sam! And as you may have seen in my comment on your Youtube video, I’ve fixed the bug with the script not running when you delete a photo.

    July 2, 2020 at 4:40 PM #41168

    Sam Moffatt
    Participant

    Awesome news on fixing the bug, I’ll have to remake the video once the fixed versions ships. Did you also fix the quirk where the record detail view didn’t update the number but the SCLV did?

    July 2, 2020 at 8:37 PM #41171

    Brendan
    Keymaster

    I think I missed the second part. But the script value did get updated after deleting a photo with my fix on the record details view though.

Viewing 6 reply threads

You must be logged in to reply to this topic.