Jump to content

Search Folders for Missing Images and Text


Recommended Posts

I am trying to create some type of warning that will search the folder that contains all of our images and text for a job and will put a red box for a missing image or red type for missing text. I know I could convert every rule to Javascript and then add the image or text error resource I create in each rule individually. I guess I'm trying to see if there is a way that you could write a rule in OnRecordStart to cover every field and rule if the resource is missing from a particular folder?
Link to comment
Share on other sites

I guess I would need to know more about exactly what conditions you're trying to test for.

 

When you say, "missing text," do you mean just that a field value is empty? If so, what exactly would you show in red? In what other way would text be "missing" that you could show it in a different color?

 

As for graphics, if you have a rule that's returning NullResource(), you could have it return a specific graphic that shows something like a red circle with a line through it. You can certainly change the border on a graphic frame, but there isn't necessarily a one-to-one correspondence between graphic resources of rules and graphic frames. In other words, you might use a graphic in more than one frame.

Link to comment
Share on other sites

I mean the file is not on the folder on the server that contains all the text files. The file is listed in the data but the actual .txt file can't be found where the file path is pointing. We have over 234 possible data fields and we need to know if something is missing in our test data prints before we run all 80,000 records. A rule would need to pull the "error" resource I would create if the file is missing, rather than the field being empty in the data. Edited by ReminderVDP
Link to comment
Share on other sites

  • 2 weeks later...

Dan,

The only issue I have had with replacing NullResource(); with the name of the Resource I used, Resource("MissingImage"), is that it will place that missing image if the field is empty. I just want it to place the Resource("MissingImage") if the file is missing from the server. I can't get an if/else statement to work for what I need.

Link to comment
Share on other sites

Oh, I see: when you say, "missing text," you mean a missing text resource file.

 

You can just call the .exists property of any FusionProResource object (returned from the Resource or CreateResource function). You can do something like this for text:

var resource = Resource("YourTextResourceName");
if (resource.exists)
   return resource;
//else
return '<color name="red">Resource not found!</color>';

Or, for graphics:

var resource = Resource("YourGraphicResourceName");
if (resource.exists)
   return resource;
//else
return Resource("MissingImage");

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...