Hasvalue variable syntax difficult to work out

Started by stefanjan2, October 08, 2025, 03:14:53 PM

Previous topic - Next topic

stefanjan2

I'm finding this a bit confusing https://www.photools.com/help/imatch/index.html?dl=h-209

I want to get something like this in the image batch processor:

hasvalue:File.MD.headline, if true {File.MD.headline}, if false {seq}

I'm very familiar with visual basic in Excel but really struggle with the variables in imatch.
 

axel.hennig

Maybe something like this:

General:
{File.MD.headline|default:headlineHasNoValue;hasvalue:headlineHasValue}

More in the direction of what you want (hopefully, because I don't know what {seq} does - never used the batch processor):
{File.MD.headline|default:{seq};hasvalue:{File.MD.headline}}
Test in VarToy app before usage.

Mario

With {seq} do you mean the {seq} pattern you can use in the Batch Processor?

Keep in mind that not every user in this community remembers every variable, pattern or other options used in one of the 3 million IMatch features. A bit more context would be really helpful.

Show use the variable you have tried. 

hasvalue returns a text when the variable has a value. As the help system points out, you can combine it with default for if-then. I've made a quick test and this worked just fine:

{File.MD.headline|hasvalue:{File.MD.headline};default:{seq}}

It outputs the headline when it exists, else the sequence number.

axel.hennig

@Mario: The link in the first post does not work (at least not on my end). We had this issue already couple of weeks ago...

Mario

It s a deep link, not sure how the OP has produced it.
index.html does not do deep links.

Always use the button next to each headline to produce link to that headline.
Hold down CTRL when clicking the button to produce a link suitable for inserting here.

hasvalue:Text
https://www.photools.com/help/imatch/var_basics.htm?dl=h-208

stefanjan2

#5
Quote from: Mario on October 08, 2025, 04:00:21 PM{File.MD.headline|hasvalue:{File.MD.headline};default:{seq}}
See screen prints
1.
File Name: {File.MD.headline|strcomp:,{File.MD.headline},{seq},{File.MD.headline}}
Output folder: E:\Photos\_PhotosNAS\{File.AT.InfoAttributes.Tablet Title}

2. Error message

So 2 files have a headline and 1 file has no headline. I can't figure out why this is not working as the output file against the error messages looks OK

I should mention the context. I have a parent folder 2024-07-03 ¦ _Canada. In the file folder panel, I want to be able display and select some or all of images in a subfolder which may be several levels deep named "Processed".

I tried to create a variable within the filter panel to select files in sub folder "Processed" but could not get anything to work so I filtered on Category "Processed and created a category "Processed" with a formula which does work: "@RFolderRegExp[Processed]"

axel.hennig

Maybe I was able to reproduce this.

What I see in your second screenshot (error message) is that the output filepath for the first file is:
E:\Photos\_PhotosNAS\2024-07 Canada \Plane.jpg

To highlight what I mean, the output filepath is:
E:\Photos\_PhotosNAS\2024-07 Canada[SPACE]\Plane.jpg

I think this [SPACE] right before the "\" (backslash) is created by entering "2024-07 Canada" into the "Table Title" (InfoAttributes) and then hitting [ENTER] (which is not needed and creates a newline in the Attribute record). This creates the space (at least in my test) and also the error message.

stefanjan2

Quote from: axel.hennig on October 08, 2025, 11:37:09 PMI think this [SPACE] right before the "\" (backslash) is created by entering "2024-07 Canada" into the "Table Title" (InfoAttributes) and then hitting [ENTER] (which is not needed and creates a newline in the Attribute record). This creates the space (at least in my test) and also the error message.
Perfect!!! Many thanks for investigating. All working perfectly now!