fheuvel Posted January 19, 2012 Share Posted January 19, 2012 I am trying to suppress a FP Expression image, but can't get it working with the following OnRecordStart script because the SetGraphic function only seems to work with graphic resources. The error message says that a FP Expression resource is not a graphic resource: var boyframe = FindGraphicFrame("shirt"); var girlframe = FindGraphicFrame("tattoo"); if (Field("gender") == "m") { boyframe.SetGraphic(Resource("shirt")); boyframe.suppress = false; girlframe.suppress = true; } else { girlframe.SetGraphic(Resource("tattoo")); girlframe.suppress = false; boyframe.suppress = true; } Is there another function? I can't find it. Any idea is very welcome. Link to comment Share on other sites More sharing options...
step Posted January 19, 2012 Share Posted January 19, 2012 While I'm not familiar with FP Expression, I do know that if you don't have the graphic linked as Resource your code will not work. Are "shirt" and "tattoo" field names in your data file that reference the entire file name of the image you're wanting to bring in? If so, CreateResource may be the solution you're searching for: boyframe.SetGraphic(CreateResource(Field("shirt"))); Link to comment Share on other sites More sharing options...
fheuvel Posted January 19, 2012 Author Share Posted January 19, 2012 Thanks for your reply. Unfortunately it won't work because shirt and tattoo are not fields but FP Expression resources. This is a special type of resource because they need to pass a datafield to FP Expression. Link to comment Share on other sites More sharing options...
step Posted January 19, 2012 Share Posted January 19, 2012 Oh, okay. I may be over my head with this FP Expression dilemma but my last ditched effort would be to try: girlframe.SetGraphic(Resource("tattoo").content); Or, could you not apply the rule to the graphic frame and then just suppress it with the OnRecordStart rule? Link to comment Share on other sites More sharing options...
fheuvel Posted January 19, 2012 Author Share Posted January 19, 2012 Great idea, just didn't see it myself. Applied the Personalised images rules to the frames and suppress them in the OnRecordStart rule. This works fine. Many thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.