Filename() oddness

For a form in which IDO “Pic1” could display many images and a generic procedure acting based on which one, I’m extracting its image name with
filename(objectinfo("formula","Pic1"))

To my surprise that returns something like

Image.jpg"

If I do just objectinfo("formula","Pic1") it returns

“thePath”

as I’d expected. Why only a terminal quote on the former when I’d expect either both or neither quotes with the filename? I can code around it, if always so, but the oddness suggests future inconsistency.

The formula for an object in the blueprint is enclosed in quotes like this:

"Formula","/Users/patjohnson/Documents/Alaska/Denali23.jpg"

The objectinfo(“formula”,"“Pic1”) would return the path & filename all in quotes:

"/Users/patjohnson/Documents/Alaska/Denali23.jpg"

using the filename( for this path with the existing quotes is using the equivalent of:

array(thetext,arraysize(thetext,info("foldersepchar")),info("foldersepchar"))

Which gets the last element of the array using the preferred separator which in this example gets every thing from the final / character to the end. This includes the final quote along with the file name. you can daisy chain a replace function in the formula to eliminate quotation marks from the base formula.

filename(replace(objectinfo("formula","Pic1"),{"},{}))

So this is not oddness with the filename( function but more so due to the fact that the blueprint formula is enclosed in quotations and they are returned with the objectinfo( function.

Here’s another way of putting it. The objectinfo(“formula” function doesn’t return a filename, it returns a formula. A formula is not valid as input to the filename( function. In your case the formula happens to be a constant, but it could be any formula. For example, the formula could be:

CatalogItem+".jpg"

Can you see why you wouldn’t be able to run that thru the filename( function? What you probably need to do is run this thru the formulavalue( function first, like this:

filename(formulavalue(objectinfo("formula","Pic1")))

Here’s the help page for formulavalue( -

Gee, TWO good explanations. I figured it couldn’t be a bug, as the subject had to be too common for any bug to have escaped notice, but I didn’t understand why. Now I do and can proceed as suggested.