Handling of NULL values

Started by jhaneyzz, March 15, 2013, 10:48:42 AM

Previous topic - Next topic

jhaneyzz

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?

Phil Harvey

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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

jhaneyzz

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?

Phil Harvey

Version 9.24 will likely be released March 23. 

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).