photools.com Community

IMatch Anywhere Discussion Boards => IMA General Discussion and Questions => Topic started by: hluxem on May 29, 2018, 06:20:20 PM

Title: Layout issues using variables
Post by: hluxem on May 29, 2018, 06:20:20 PM
I just spend some time trying to tackle an issue where I missed some information for some pictures using a modified layout downloaded from the forum (Thanks Sinus!). It took me a while to realize that it was caused using a custom template for one of the headers. Please note that none of the headers where displayed for these files, not just the header with the "bad" expression.
The custom template sets the background using the file extension, but the .ARW extension was not listed. None of the headers were displayed for files with the .arw extension.

Below is the custom template used. I removed all but 2 extensions from the list to make it easier to read.

<Run FontFamily='Lucida Console'  FontWeight='bold' FontSize='9pt' Foreground='#FFFFFF'  Background='{File.Ext|is:NEF,#E40000,}{File.Ext|is:BMP,#00bb00,}'>{File.Ext|to_upper}</Run>

I assume the background is set for the extensions listed, is there a way to add an "else" so the background is set for all other extensions?

Thanks a lot,

Heiner
Title: Re: Layout issues using variables
Post by: sinus on May 29, 2018, 06:49:17 PM
Heiner,

you could try this here:

<Run FontFamily='Lucida Console'  FontWeight='bold' FontSize='9pt' Foreground='#FFFFFF'  Background='{File.Ext|is:NEF,#007d00,#E40000,,}'>{File.Ext|to_upper}</Run>

Title: Re: Layout issues using variables
Post by: Mario on May 29, 2018, 06:53:46 PM
There is an extra comma. In general:

the is: function as ae false/else clause.
From the Variables help:

is:Value,TrueValue,FalseValue,case

So you can just do a

{File.Ext|is:NEF,#007d00,#E40000}

and #E40000 will be used when the extension is not NEF.

The problem is that you have multiple is: checks, and there is no "global" else for all these if: statements. There is no "if in list, else" function.
If you need to do such a thing, you have to explicitly list all extensions you want to color.
Expressions so complicated are unusual and of course are also real bad for performance in the file window, impact scroll speed, screen refresh times etc. I would not overdo this...

Tip: I can only recommend to try such things out in the VarToy app. It will immediately show you what your variable returns.