ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: jhaneyzz on March 15, 2013, 10:48:42 AM

Title: Handling of NULL values
Post by: jhaneyzz on March 15, 2013, 10:48:42 AM
I am using the output of an exiftool recursive batch process to feed into a MySQL database.

Given that, I am using the -f option to ensure that each field has a value and thus does not cause misalignment of file metadata in the database columns.

However, it appears that when exiftool encounters a NULL value (for instance, asking for an xmpDocumentID from a file without XMP data) the corresponding field contains a dash "-" rather than NULL.

This results in lots of tedious data cleansing that I would rather avoid.

Is there a way to control what value is inserted in such cases?
Title: Re: Handling of NULL values
Post by: Phil Harvey on March 15, 2013, 11:04:27 AM
Currently there is no way to specify the value returned for a missing tag when -f is used.

It sounds like you would prefer an empty string in this case?  How would you differentiate the case where a tag is missing from the case where the tag exists but is an empty string?  Or does this matter to you?  Just curious.  This is the reason I chose a "-", although of course you still have the problem of differentiating a "-" from a missing tag, but this value is much less common than an empty string.

- Phil
Title: Re: Handling of NULL values
Post by: Phil Harvey on March 15, 2013, 11:20:26 AM
Hey, I just thought of a way I can add this functionality.  I will change the application to honour the API's MissingTagValue option setting.  With this update, ExifTool 9.24 will allow you to do what you want with this config file:

%Image::ExifTool::UserDefined::Options = (
    MissingTagValue => '',
);


- Phil
Title: Re: Handling of NULL values
Post by: jhaneyzz on March 15, 2013, 11:35:17 AM
Phil,

Thanks for the frighteningly quick responses.

Yes, I would prefer the missing value to be an empty string. i.e. in tab-delimited output it would get the following output for two found values followed by two values which were either a tag whose contents is an empty string, or a call for a non-existent tag. (In my case I don't need to differentiate between the two.)

value1[tab]value2[tab][tab][tab]


As to your second message,

when will you be releasing 9.24?
Title: Re: Handling of NULL values
Post by: Phil Harvey on March 15, 2013, 12:15:46 PM
Version 9.24 will likely be released March 23. 

- Phil