Jump to content

Pull graphic resource based off of string


bmo

Recommended Posts

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? 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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");
Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...