Category "Concatenation"

Started by harrylah, March 18, 2015, 08:53:29 AM

Previous topic - Next topic

harrylah

Hi all,
I have a question on how I would best achieve results:
Imagine I have a category (or keyword) date system like

2015
  02
    01
    02
  03
    18
    19

I would like to create another set of keywords/categories in the form
20150201
20150202
20150318
20150319

Simply put, I'd lke to concatenate all levels/children of a given node/parent into one level. How would I best schieve that?

Thanks,

Harry

Mario

Hi, welcome to the community.

I'm not sure that I understand exactly what you are trying to achieve.
You speak of keywords and categories. This may mean totally different things!

To create a category '20150201' somewhere in your category tree you could:

1. Create the category and make it an Alias of "2015|02|01"
-or-
2. Create the category and use a category formula which refers to "2015|02|01"

This is easy to do with IMatch categories.

It is impossible with keywords, though. This is where your post is unclear. Do you want to assign a keyword "20150201" to all files which have the hierarchical 2015|02|01 keyword? I doubt there is an easy way to achieve that, except some regular expression logic and a Metadata Template...
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Ferdinand

Harry is an old timer from the 3.6 days.  Good to see you here Harry!!   Welcome.

I don't understand your request either, but we'll do our best to help you.  Have you looked at the timeline view in IMatch 5?   It may do what you want.

harrylah

Hi guys, yes, I'm a yery old hand indeed. I registered IMatch in back in 2002, IIIRC, started excited with pretty much a DB view and a category view and am now in the wonderful world of automagic XMP population from whatever metadata repository. File sizes grew from a couple of hundred k to mid 20 M per file, now with automagic version handling (thanks, Ferdinand, for your script, saved me years of manual assigning!) and so forth and now I struggle with what I used to call string contatenation in my VBA times! :-)
Unfortunately my photographic skill didn't nearly evolve as IMatch did, but then hey, for me it's still just hobby. Expensive though (I'm on Canon) and time consuming, but such a joy. btw, is khodadad still around? Such a fountain of scripting knowledge!

Anyway, back to my problem. I was hoping to be clear enough with a "date-like" explanation - obviously I was not <blush>. I'm dealing with pdfs here. Currently, they are named like "scanned001.pdf", "scanned002.pdf" and so on. I manually assign them to categories like

date
  2015
    03
      18
type
  invoice
  announcement
  bom

sender
  shop a
  ministry of finance
  ...

If I can't achieve what I want with keywords, I'm more than happy to accomodate categories, I have no preference here. Yet. ;-)

Now, I would like to rename the files to something like "20150318_invoice_shop a.pdf", or, more generically - gosh, how do I say that

<whatever child of date><whatever 2nd child under whatever child of date><whatever 3rd child under whatever 2nd child under whatever child of date>_<respective type>_<respective sender>.<extension>
Clear now? And yes, I was on metadata templates, that I already figured out. ;-)

Best wishes

Harry

Mario

Your operation sounds complicated.

I would start with a variable like

{File.Categories|level:leaf;replace:~;==_}

which returns all leaf-level categories (the bottom-most categories) as a list separated with ;
The replace function replaces ; with an _

If you have a file assigned to the categories "type|invoice" and "sender|shop a" and "date|2015|03|18" the above variable returns

shop a_invoice_18

Use this as a start, e.g. in the Renamer or a MD template.

If you want to do such complicated things, study the Variables help topic  carefully, especially the section about category variables and how you can filter and control the output.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

harrylah

Great - that helps a lot. I wasn't aware of the "|leaf".

Thanks!

Harry