Formula image display object has trouble with ?(

Here’s a quirky and not too serious problem for a Friday afternoon. I have a database that tracks Covid cases in our locality (Massachusetts), and reports them with an old and now deprecated color scheme. I have a form that uses an if else query to set the color based on the contents of a field called “Color”. containing just gray, green, yellow or red. The query in the formula box of the image display object is:

?(Color contains "Gray", "%%B0B0B0",?(Color contains "Green","%%40F040", ?(Color contains "Yellow","%%F0F040","%%F03030")))

Starting with the last version (10.2.0.b26 on Mojave), the color stopped displaying correctly in the view-as-list form I use to report. Interestingly, it prints fine (colors intact) and displays ok when I change the form to individual pages. In view-as-list, it only displays the first choice possible (gray here, but whatever color value I enter), as though it was evaluating the first choice as always true. Making the choice simple and non-nested doesn’t help. I removed all objects other than image display, and the behavior persists. “ifelse(” behaves just as “?(” does.
This doesn’t bother me, as I need the pdf ultimately, but someone might be startled to see this.
Other than this little quirk, I’ve been enjoying the new build. For whatever reason, it seems quite a bit faster, even on my system (2017 MBPro). Thanks for the huge effort to get here.

This is a known issue with View-as-list forms. For the moment I would try to rebuild that form with a Text List object instead.

1 Like

Thanks for your response. I can say that this worked correctly until the very last update to Pan X, which used the (presumably) different compiler on the M1 chip. I know that displaying images from files has been a big problem, but I’m only asking for display of a color based on the RGB numbers. I looked through the forum for the same issue with view-as-list, and if this problem was discussed there, I missed it.
I’m perfectly fine, since I know that my pdf will display colors even if the form doesn’t.
I just thought that this would be a small problem that Jim might want to look into, especially to see if it might be an issue elsewhere.

I don’t think it is a known issue. I have never heard of it, and could not find it in the list of known issues. And @rblatchly is correct – it works in b25, so this is a new problem in b26.

Note that the ?( function is not the problem – the problem is displaying colors. The same problem will appear with a simple formula that doesn’t use the ?( function, or any functions at all for that matter. I have added this as a new bug.

@rblatchly I would like to point you to the “new” syntax of the ?( function which no longer requires nested functions for multiple cases. Since Panorama X you can put multiple boolean formulas in a single ?( function, like this:

"%%"+?(Color contains "Gray","B0B0B0",Color contains "Green","40F040",Color contains "Yellow","F0F040","F03030")

Notice that this requires only one parenthesis at the end. Much simpler to not have to keep track of how many ?( you have nested.

But since you are always comparing the same value with contains, there is an even easier formula to accomplish this:


Here is the documentation for this very useful function.

Note - none of this will help with your immediate problem, which is that display of colors in an Image Display object doesn’t work. This is just for future reference.

O.K., I remembered that there exists a problem with the calculation of formulas in the header of View-as-List forms where the data would always be taken from the first selected record. (I had reported about such a problem on February 3, 2022.)

But when I read this thread again, Rich’s problem is not related to cells on headers of a View-as-List form, but to cells on the data tile. Sorry, my fault.

Thank you for the kind and thorough reply. I do want to make sure that you know that I can see colors if I just put in one descriptor, or change the first entry in the conditional. It just doesn’t evaluate the choices. Maybe this depends on the system (I’m way back in Mojave).
I also appreciate the much more elegant way to code this–I must have a groove in my brain for the nested ?(, which I should pave over with the alternatives. I’ll certainly try them out to reinforce it. This form was always a quick and dirty way to report weekly data to a group trying to cope with Covid planning, although it ended up being quite useful.
I’m glad this is on your radar, and hope the fix is easy.