Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > The JavaScript Library

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 1st, 2018, 11:34 AM
mjlongo mjlongo is offline
Junior Community Member
 
Join Date: Jul 2013
Location: Rochester NY
Posts: 47
Default Simple question for when a graphic file does not exist

I'm using the following code to return an inline graphic:

Code:
return CreateResource(Field("name") + ".pdf", "graphic");
It works fine. However, the customer did not supply every file necessary. When the file does not exist, I instead want to simply return the name field using an appropriate font.

So my question is pretty simple, how do you check that the graphic file indeed exists and if not, run a different set of code?

Thanks!
Reply With Quote
  #2  
Old February 6th, 2018, 08:25 AM
ScottHillock ScottHillock is offline
Regular Contributor
 
Join Date: Mar 2010
Posts: 94
Default Re: Simple question for when a graphic file does not exist

I would do this by creating a text frame set on top of a graphic frame and use this:

Code:
Pic = CreateResource(Field("name") + ".pdf", "graphic", true);
if (Pic.exists){
	FindTextFrame("Text").suppress = true;
	return Pic;
}
else{
	FindGraphicFrame("Image").suppress = true;
	return CreateResource("");
}
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 01:13 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.