Metadata Template - possible to use logic to avoid empty fields?

Started by Jingo, May 24, 2023, 05:10:45 PM

Previous topic - Next topic

Jingo

I believe the answer to this is NO - but figured I would ask anyway in case I'm missing something obvious.

I have a metadata template that takes values from the Location Shown Country and Location Shown City and builds a hierarchical keyword from them: ie: Places|Portugal|Obidos.

If one (or both) of the values in the XMP fields are blank (because I haven't gotten around to geo coding yet), then I get a nil keyword: ie: Places||

I was wondering if it is possible to add IF logic to the template itself to only create the tags if the source XMP tags contain values?  

Not a major issue because I can easily just select all the images and manually delete the empty keyword in the keyword panel but just wanted to see if I was missing an easy action/logic.

Thx! - Andy.

IMatch2021x64_usLJJLyEds.png

Mario

QuoteI was wondering if it is possible to add IF logic to the template itself to only create the tags if the source XMP tags contain values? 
This is normal variable. You can use all variable logic including hasvalue or default. prefix or similar to produce a valid keyword, or an empty keyword.

When I understand your post correctly, you'll end up with the keyword Places|| if your keyword sources are empty.
So you need to check if the sources are non-empty and only emit Places|| when this is not the case.

For example: {File.MD.make|hasvalue:YEP} outputs YEP when the file has a non-empty make tag, else an empty value is returned (which would result in no keyword being added).

Rearrange your variable to something like this and you're good.
Check if you have a non-empty Location Shown with hasvalue, and then place your variable where I have the YEP.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Jingo

Ahh... nice that you can use variable logic there... I didn't think to try it!  All set.. works like a charm (of course!).  Thx Mario.

Mario

Very good.
You can use variable logic everywhere you can use variables.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook