Change Image Path Pending a Tag Value Change

Hello,

I am trying to make an image change when a tag value has changed within a component script. Below is the code I have so far based on how I would expect it to work. Can anyone tell me what I am doing wrong or if a component script is not the best way to do this?

if “ZTrak/Station 14/Station 14 Bundle Number” == “BM25120”:
system.nav.swapTo(“CEgx26338.png”)
elif “ZTrak/Station 14/Station 14 Bundle Number” == “BM25107”:
system.nav.swapTo(“CEgx26336.png”)
elif “ZTrak/Station 14/Station 14 Bundle Number” == “BM25112”:
system.nav.swapTo(“CEgx26337.png”)
else:
system.nav.swapTo(“ztrak.png”)

Thank you!

TTT…

Hi John,

Where exactly are you putting this script? At first blush (and not enough info), I’d say you’re trying to bind to property, which will require an expression, and not a script.

If so, you may want to look at the switch function. The attached window shows an example of this in the Image Path property of the image component.
[attachment=0]Image Pointer_2016-05-09_1326.proj[/attachment]

As the script itself is concerned, system.nav.swap() navigates between windows and not really suitable for images.

Or maybe I’m all wet, and I don’t really know what you’re looking to do. Age, and all that… :laughing:

Let me know what I can do to help.

I replace images with those i have uploaded to the Image Management component using the ‘replace’ expression function.

When the tag changes, i take the value of the tag, substitute into the image path using the replace expression and fetch an image from that folder.

All my images have the same name (such as ‘header’, even though they differ), but the folder path changes.

The only caveat is that your folder structure needs to match the tag names otherwise the look up will not work…