bmo Posted October 4, 2023 Share Posted October 4, 2023 Hi, I'm trying to build a a graphic rule that will pull a resource based off of a string that is built. For example: i've built a global function that returns the string Resource("page1-stone1-10.tif"). If I use this function as a graphic rule, it does not return the referenced image. If I use it as a text rule, it does return the correct string that would reference to the resource that is named accordingly. Is it possible to do this or do I have to manually link each graphic resource via a switch/if statement? Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted October 4, 2023 Share Posted October 4, 2023 I don't understand what you're trying to do. Why not just have the function return the resource itself, instead of a string? Maybe posting your function code would clarify. If you're doing something like this: function GetResource() { return 'Resource("page1-stone1-10.tif")'; } Then you should do something like this instead: function GetResource() { return Resource("page1-stone1-10.tif"); } Again, if you post your current code then someone here will probably be able to spot the problem pretty quickly. Quote Link to comment Share on other sites More sharing options...
ThomasLewis Posted October 4, 2023 Share Posted October 4, 2023 I think bmo is just trying to create a resource based on a series of things, ie building out the image name "page1-stone1-10.tif" bmo, if this is the case, you can create a Graphic rule that is simply: return CreateResource(page + "-" + type + "-" + number + ".tif", "graphic"); or return CreateResource(Field("page") + "-" + Field("type") + "-" + Field("number") + ".tif", "graphic"); Quote Link to comment Share on other sites More sharing options...
bmo Posted October 5, 2023 Author Share Posted October 5, 2023 Hi all, thanks for the response. I have hundreds of .tif images that are named very similiarly, so I built a string based off of some data pulled and manipulated from the data file. I found a post on here about returning a <graphic> tag, and adding it to a text field. That did the trick. Thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.