Inserting an Attribute and Flat Keyword in a custom layout in File Window

Started by Damit, March 16, 2023, 03:58:26 PM

Previous topic - Next topic

Damit

I am trying to display the Orientation Attribute in a metadata template I have created.  Unfortunately, despite referencing the Help section, using the Var Toy and searching the forum, I cannot find an explanation on how to display the Orientation as it is displayed if I just select Orientation on the pull-down of the Attribute field. I tried this:

<StackPanel VerticalAlignment="Top" HorizontalAlignment="Right">
  <TextBlock>{File.Size}</TextBlock>
  <TextBlock>{File.Width} x {File.Height}</TextBlock>
  <TextBlock>{File.MD.orientation}</TextBlock>
</StackPanel>

But instead of the Orientation reading as "Horizontal (normal)" it reads as "1." How can I insert Orientation in my template so it will not display in what I assume is short code? So it would display like this:
1.32 MB
2832 x 2128
Horizontal (normal)

And while we are on the subject, is there a way to display the Keyword Attribute as flat?

Mario

{File.MD.orientation|value:formatted}

See Metadata Variables: Formatted and Raw

The EXIF orientation tag (same for XMP) is a numerical value. The meaning of the numbers comes from the EXIF Standard and ExifTool stores them in a table. When you request the formatted value, you get that name instead of the number.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Damit

Thank you!!!  I thought I had seen this but I could not find it. :-[ I did try for almost 40 minutes though.  Not the most fruitful of times.

How about displaying the keywords as flat? I tired "Keywords" and it is still Hierarchical even though there is a Hierarchical Keywords. If I choose either they display the same.

Mario

QuoteHow about displaying the keywords as flat?

Which keywords? Which variable do you use and how?
What does flat mean for you?
IMatch flattens keyword on write-back! How keywords are flattened is controlled via Edit > Preferences > Metadata.
If you access the flat XMP keyword tag instead of the hierarchical keywords, you get the flat keywords in your files.

-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Damit

The keywords in input in IMatch.  I use hierarchical keywords such as Where>Regions>Europe>Italy.  By Flat, I mean just displaying Italy.  On the Keyboard panel, there is a toggle to show hierarchy.  I would like the keywords to display as they would in the keyword panel if one did not have "Show Hierarchy" enabled.

I don't want to write them back as flat. I want to keep the hierarchy, I just don't need to display it in the File window due to a lack of real estate. It would clutter up the display.

Is flattening keywords during write-back the only way to display your keywords as flat in the File Window?

Mario

Yes. There is no variable function that allows you to "from these values, separated by ; extract the part of each string that follows the last |...

In IMatch 2023 you can do that using

{File.MD.hierarchicalkeywords|foreach:{value|substr:{value|findreverse:|;math:add,1}}<br/>}

by utilizing the new findreverse function in combination with foreach and math. Yes, this is somewhat advanced and 99% of all users will never need such complex variables.

If this is fast enough for a File Window, where IMatch might display hundreds or thousands of files, I don't know.
Using too many and to complex variables in a File Window is a great way to reduce performance considerably.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Damit


Jingo

Maybe I'm misunderstanding - but are you trying to display the "leaf" keyword in the file window - like this (ie: Rocks which is really a hierarchical keyword: Objects|Rocks)? 

IMatch2021x64_L1HpedC6h1.png 

If so, I have been doing this for a long time using the following custom layout command:

{File.Categories|filter:@Keywords;level:leaf}

Damit

Thanks for your response, Jingo.  For some reason I cannot see the pic or the command. Is there something I am doing incorrectly?

Jingo

sorry.. was editing the post to add the images outside of quick reply.. you are fast!  

Mario

Quote from: Jingo on March 28, 2023, 03:46:23 PM{File.Categories|filter:@Keywords;level:leaf}
A good approach using categories.
Did not remember that at the time.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Jingo

Quote from: Mario on March 28, 2023, 03:54:49 PM
Quote from: Jingo on March 28, 2023, 03:46:23 PM{File.Categories|filter:@Keywords;level:leaf}
A good approach using categories.
Did not remember that at the time.

Well.. you can't remember EVERYTHING...  8)  

Damit

Quote from: Jingo on March 28, 2023, 03:53:09 PMyou are fast! 
Sometimes, but only when getting myself in trouble! 8) Thank you so much for your suggestion. I really appreciate it greatly! I will try to get that going a report back if there are any issues.
Quote from: Jingo on March 28, 2023, 03:58:08 PMWell.. you can't remember EVERYTHING...  8) 
Nonsense! Mario MUST remember everything! ;D

Seriously, there are SO MANY things going on with IMatch I am not worried about Mario getting hit by a bus, I am worried about his head exploding!!

Damit

Quote from: Jingo on March 28, 2023, 03:46:23 PM{File.Categories|filter:@Keywords;level:leaf}
I have tried this but it is not working. Is there a typo in there? I did look in the variable selector and tried {File.Categories|level:leaf} and that produced some information, but not keyword leafs.  I also checked to see if the @keywords was populated and it was, so I cannot figure out what is up.

Mario

Works fine here.
I select a file with keywords, paste the variable into VarToy and it shows the leaf keywords of the file.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Damit

Ok, I figured out what was going on and it might point to a larger problem.  Hopefully not.
I looked more closely and I was incorrect.  The @keywords are not populated even though the keywords exist in the keywords attribute. As a matter of fact, in the attached pic there is not one category populated.  I thought any keyword would populate to the @keyword category automatically. Even worse is now I realize I have 2 @keywords in my category list, with slightly different counts. I am not sure when this happened, as I did not notice this until now, but it could be something I overlooked for a while.
Why could this be occurring?

Damit

I did a database diagnostics and also compacted and optimized it and the duplicates remain.  I am attaching the log created after the diagnosis. One difference between the 2 @keywords is that one of them has 2 @Builder categories within it, one with a wrench icon and another with a small red icon with a minus sign, the other @Keyowrds has no @builders within it.

Mario

@Keywords is a system category and automatically created and maintained.
It is a data-driven category that is automatically filled from the hierarchical keywords in your files.
All this works automatically.
You cannot rename or delete @Keywords. At least it should not be possible and no user ever managed to do it.
Did you create categories manually? Did you export and import categories?

Show me a screen shot of the Category View.

I have added your image to a test database. It contains 5 keywords, all starting with Who
After adding the image to the database, @Keywords updates and shows this (names blurred for privacy reasons):

Image3.jpg

-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Mario

The diagnosis log reports that your database has 279 categories below @Keywords|Who|People|In Pic
I see no duplicate @Keywords category.
Do you have enabled a filter in the Categories View (Panel below the tree on the left)?

-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Damit

Here is the screen shot
Categories screen shot-edited.jpg   

As you can see there are 2 @Keywords.  I had cleaned up the the individual names, People in Pic and People present, moving their contents to the appropriate place under "Who" but somehow they reappeared.

I don't know how, but my keywords and categories got muddled up once more.  I had cleaned everything up, but I guess I will do it again. I can handle that, though I need to figure out how things are getting screwed up.

I am working with lightroom and IMatch, but I looked at my lightroom keywords and they only have the How, What, When, Where and Who Parent Keywords and everything that is contained therein, so I don't think it is introducing duplicates that are not in its keyword list. I think this occurs while working in IMatch.

Anyhow, the keywords in the picture seem to reside in the second set of @keywords.  I assume that, for some reason, that @keywords is not being read by the formula to populate the leaf?

Quote from: Mario on March 30, 2023, 03:17:28 PM@Keywords is a system category and automatically created and maintained.
It is a data-driven category that is automatically filled from the hierarchical keywords in your files.
All this works automatically.
You cannot rename or delete @Keywords. At least it should not be possible and no user ever managed to do it.
Did you create categories manually? Did you export and import categories?
Of course, if it is possible to break something, I will. Yes, I created some categories, but not those.  I created something called Mario's Categories, but I don't think I have used them at all. I am still figuring out what I want to do with categories, though I am starting to get some ideas on the matter. I have not imported of exported categories. I am also not using the filter in the category panel.

Mario


QuoteI had cleaned up the the individual names, People in Pic and People present, moving there contents to the appropriate place under "Who" but somehow they reappeared.
You did what and where?
Cleaned names of what? Moving what from where and how?
To work with keywords in your files, please use the Keywords Panel.

I don't understand what you do or how you managed to create a category with @ as the first character. IMatch does not allow users to create categories starting with @ because that is a reserved character.

I have never seen something like this before.  And I have no idea where even to start to unravel this mess.
When this this second category show up?

The first @Keywords category is the original. It shows the "speech bubble" icon.

The second @Keywords category is a data-driven category that looks like you have created and set-up somehow?
It shows the normal data-driven category icon. IMatch does not create this type of category.
Can you delete this duplicate category?
It will not work like the special @Keywords category and will cause confusion. IMatch does not do anything with this category.

What you have in your Lr catalog does not matter.
IMatch only looks at the keywords in your files, not in the Lr catalog database.
I also work with Lr and I can assure you, IMatch does a good job working with keywords Lr has written into your files.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Damit

Quote from: Mario on March 30, 2023, 04:01:08 PMYou did what and where?
Cleaned names of what? Moving what from where and how?
To work with keywords in your files, please use the Keywords Panel.
When I began using the program I did not understand how the @keywords and Thesaurus were not linked and I created a bit of a mess with duplicates but I cleaned it up by moving every keyword to the appropriate place doing exactly as you suggest: with the @keyword panel. After I did this, the @keywords (the original one) just showed the How, What, When, Where and Who Parent Keywords and everything was contained therein.  I do not know how the duplicates and cleaned up keywords reappeared but I did not recreate them purposefully.
Quote from: Mario on March 30, 2023, 04:01:08 PMI don't understand what you do or how you managed to create a category with @ as the first character. IMatch does not allow users to create categories starting with @ because that is a reserved character.

I have never seen something like this before.

The first @Keywords category is the original. It shows the "speech bubble" icon.

The second @Keywords category is a data-driven category that looks like you have created and set-up somehow?
It shows the normal data-driven category icon. IMatch does not create this type of category.
Can you delete this duplicate category?
It will not work like the special @Keywords category and will cause confusion. IMatch does not do anything with this category.

What you have in your Lr catalog does not matter.
IMatch only looks at the keywords in your files, not in the Lr catalog database.
I also work with Lr and I can assure you, IMatch does a good job working with keywords Lr has written into your files.
I did not create this category on purpose. I don't think I even created it. I can delete the 2nd @keywords. What is curious is it seems to have so "keywords" that the original ones does not.  I will move the info and delete it. Hopefully deleting it will allow the leaf formula to work.

I really want to figure out how this happened.Its a bit disconcerting that it did. I really don't remember doing much with categories. I am glad to hear that IM and LR play well together, not that I doubted it.

Mario

IMatch manages only the official @Keywords category.
If the second category is a regular data-driven category, it will show the keywords, but not provide additional functionality like @Keywords does.

I could not create a category named @Keywords manually.
I even entered @Keywords as a keyword in the Keywords Panel. This did not do any harm either (IMatch replaces the @ with a safe replacement character while updating the @Keywords category, since @ is not allowed in non-system categories).
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

thrinn

Looks very strange. In addition to the two @Keywords top categories, the screenshot shows also two @Builder categories. But as Mario wrote, trying to create a category with a @ should give an "invalid name" error. It does for me.

@Damit: Your screenshot shows the Categories View, not the Categories Panel (normally on the left hand side, tab right to Media & Folders). Do you also see the double entries in the Categories Panel? Even after refreshing the categories there?
Thorsten
Win 10 / 64, IMatch 2018, IMA

Damit

Thanks Thorsten. Yes, they are both the same as far as I can tell.  This is very weird indeed, and as has been proven by you and Mario, I could not do it manually, so how was it created? :o 

I still do not understand why the leaf formula is not working because the keywords do exist in the original @keywords.  I only hope with the deletion of the duplicate that the functionality returns.

I think I have a technology gremlin haunting me. :(

thrinn

May I suggest that you first try to rename the non-standard @Keywords and @Builder categories to a "regular" name like MyKeywords and MyBuilder? That would at least reduce the potential for confusion a bit.
Thorsten
Win 10 / 64, IMatch 2018, IMA

Mario

Yes. Delete or Rename the superfluous categories.
You did not tell us when these showed up. Did you use category export / import at some time?

I have no clue about how this can happen.
The user cannot create categories starting with @ and IMatch creates @Builder and @Keywords only once, when the database is created. Or when the categories are missing (during migration of very old databases).

If you want, upload the database to your cloud space and sent me a link to support email address.
I can then check it out and maybe fix it / see what the problem is.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Damit

I will move the contents that are different, if necessary and then I will delete it after making a back up.

Unfortunately, I do not know exactly when this happened.  I only noticed it now because I could not get the leaf formula to work. I have no idea how it happened.

I have never exported or imported categories, as I have not really used them yet (though I think I will use it for private information). I will upload the database.  Do you want me to upload the current one or the one after I delete the duplicate? Thank you for the offer to look at my database!

Mario

Upload the current one.
Include a link to this thread so I know what's what. I get many emails per day.

It might take a while for me to get to this. I still have a couple of "my metadata does not work" customer requests in my inbox and they a) usually take a long time to analyze and b) are not the fault of IMatch. But I can only do so many in a day, and first comes first.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Damit

I will upload and send a link once it is up.  Take your time, I know you are busy and have a lot to do. I can wait and appreciate the help. Thank you so much! I just want to figure out how this may have occurred.

In the meantime I will try to fix things and see if I can get that formula to work.

Damit

OK, so I deleted the category after moving some stuff around.  Weirdly I noticed that the description of that imposter @keyword category was the same as @keyword. Also, I could not delete the imposter using the Categories Panel that resides next to the Media & Folders tab. I could only delete it from the category panel. Anyhow, once I deleted it, the leaf formula works.

However, the new keywords I made to move the information from the imposter to real @keyword category are now not populating to @keywords.  The kyword exists in the Thesaurus and the keyword panel shows the keyword checked, but @keywords does not display it. I have refreshed several times and written the metadata. I am not sure why this is happening but all these issues are a bit disconcerting.

Mario

QuoteThe kyword exists in the Thesaurus

This does not matter.
@Keywords is based on the actual keywords in your files.

Quoteand the keyword panel shows the keyword checked, 
What does checked mean?
Is the keyword shown in the upper area of keywords in the Keywords panel?

Image1.jpg
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Damit

I almost wrote "Not that it matters" after stating it was in the Thesaurus. Yes, the keywords are checked in the Keyword panel with an X in the box next to it, and they (it is happening with all new keywords) are showing in the upper area, just as you displayed. The keywords are assigned they just are not showing in @keywords. I have even face tagged some photos in LR and re-scanned them in IM. When I did so, the annotations transfer and show in the field I dedicated to them in the file window, but the keywords I defined to populate in the People window do not show in the leafs when I use the formula, but when I change the field from the formula using leafs in @keywords to just use the attribute Keywords, they appear.

It is almost like the link to @keywords from the keywords is broken. I did notice that most of the recent keywords I had added to IM were only present in the imposter @ keyword. They were not showing in @keywords and that is why I had to manually move them. I am still waiting for my database to upload or else I would have sent you the old database (not that I expect you to work on it now, but just in case you wanted to reference it). As soon as it uploads I will send it to you so you can check at your convenience.

Damit

I am attaching a log file, just in case it helps.  I thought maybe things would update with time, but the new keywords I am adding are not showing up in @keywords.

Mario

-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Damit

In IMatch I click on the file and then a check the box in the keyword panel and hit ctrl+S to make sure it saves.  I then see the keyword show up in the top section of the keyword panel. When I checked the exif output I can see the keywords being processed and when I go back to the file the keywords are there, displayed, again, on the top section of the keyword panel, which signify they exist and are attached to the file, but the keywords are not showing in the @keywords category.

Mario

Have you configured IMatch to immediately write-back any change you do?
This is bad for performance and rarely needed. S
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Damit

No I have not.  At least I don't think so. I use the command>metadata write back and there are always pending files so I assume I have not. Where would I change that setting so I can double-check?

Mario

QuoteI use the command>metadata write back
That explains that. You don't need to write-back all the time. IMatch stores your changes in the database, and you can write-back when needed or you don't need your PC for a while.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Damit

Thanks! I was just writing back to see if that was the reason why the keywords were not propagating to @keywords. You are right, when I write back the programs stalls for a bit.  Still, I don't understand. How does this explain IMatch not propagating keywords that exist to @keywords after waiting over 24 hours or the error that occurred with the duplicate @keywords and builders? I am not facing slow, but rather erratic performance. What am I missing?

Maybe more will come to light when you can check the log and/or the database. I will patiently wait and continue on with my tagging for I know the information resides with the files, it is just that IMatch seems to be having difficulty managing it at this moment.

Mario

I have analyzed the problem and described how to fix it in an email sent a minute ago.
Let me know if you did not receive the email. hotmail.com is cranky and sometimes deletes emails without informing the recipient.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Damit

Sorry, life called and just seeing his now.  I did get the email and will try to digest and execute.  Thanks for the help!!

Mario

Very well.

Let me know if it worked. It should.

Pay attention to what you do, in case this very obscure issue happens again. Maybe you can give me steps how to break IMatch.
This was never reported before and I have no idea how to reproduce this...
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Damit

I performed the fix and it seemed to work. One @Keywords and one @Builder. It seems some of the Keywords are repopulating the @keyword category, including the ones that were not updating prior. Like I said I have no idea how I broke IMatch, but I will try to pay attention to any changes and see if anything like this happens again. 

Thank you so much for your help!