Jump to content

Graphic Switch Rule


JoyceKeller

Recommended Posts

My Fusion Pro template works great offline.

It does not work online.

Basically, when a user chooses a photo, the rest of the data associated

with the photo fill in the appropriate FP boxes, as well as the appropriate layout orientation for horizontal or vertical.

Can anyone show me a better way to do this so it will work online?

I am attaching a zipped folder of my work

Kind regards, and thanks in advance

Joyce Keller

Link to comment
Share on other sites

I still need help, then. Thanks for the note, Dan.

 

The differences I am seeing:

In FP desktop, I can see the photo chosen, the correct layout orientation for horizontal or vertical, plus the title and caption that are pulled when the photo is chosen by a switch rule.

 

On the web, NOTHING shows up in the preview or the PDF. The result is blank.

 

What do I need to do differently to make this work on FP Web?

 

Thanks in advance

Link to comment
Share on other sites

Joyce,

FusionPro Web does not support the use of a Graphic Switch Rule to drive the return for other data in the template. This functionality does work in Desktop, but the issue in Web is that the path to the image is not the same as that in Desktop.

 

WORKAROUNDS:

1. If the user does not need to BROWSE for the image, then they can use a text dropdown for their switch rule conditions instead. The text field would do nothing but trigger the image and the other data you referenced.

2. There is a function called "matchPathToString" which can be placed into the JS globals, which looks for the string inside the path to the Library. Here is an example of the string it looks for: "\\Sdfsc01.san.printable.com\isrepository\Libraries\12345\BackgroundColor\images\src\something.jpg" which fgoes to the Library containing "something.jpg". Eventually this function will be added into the Building Blocks of the rules editor. Below is an example of the Rule you would have to create (without using the Switch Wizard):

 

if (matchPathToString(Field("Photo"), "something.jpg"))

{

return "Something Else";

}

 

else if (matchPathToString(Field("Photo"), "nothing.jpg"))

{

return "Nada";

}

else return "";

 

Hope this helps!

 

 

Link to comment
Share on other sites

Hi Rich, thanks.

Sorry it took so long to get back. I was pulled onto another project.

 

Question: where and what do I insert for the JavaScript Global? If I do nothing but use the Rule you have suggested, with an unreferenced matchpathToString, will FP Web pick up on this once I upload it?

Link to comment
Share on other sites

Hi Rich,

Sorry I'm such a dummy, but what do I write in the JavaScript Globals? From the example you sent the other day, it looks like I need to reference a path to the Library and I don't think I have access to that information on Printable...

thanks

Link to comment
Share on other sites

Joyce,

Well I'm clearly a dummy myself, I forgot to include the actual function that you need to place in the JS Globals. Just copy and paste the content below into the globals and use the "Switch Rule" outlined in the previous post:

 

function matchPathToString(path, stringToMatch)

{

path = ToUpper(path);

stringToMatch = ToUpper(stringToMatch);

 

searchResult = path.indexOf(stringToMatch);

 

if (searchResult > -1)

return true;

 

else

return false;

}

Link to comment
Share on other sites

  • 2 weeks later...
Joyce,

FusionPro Web does not support the use of a Graphic Switch Rule to drive the return for other data in the template. This functionality does work in Desktop, but the issue in Web is that the path to the image is not the same as that in Desktop.

Just to clarify here, it's not entirely accurate to say that "FusionPro Web does not support the use of a Graphic Switch Rule." You can upload the Frodo Travel Tutorial to FP Web and it will work just fine, even though it has a Switch Wizard rule of "type" Graphic.

 

Specifically, the problem is not with Switch Wizard rules of type Graphic (which return graphic resources). Rather, the issue is with Switch Wizard rules which switch on a field of type Graphic. Whether the rule returns graphics or text is not relevant.

 

The design intent of the Switch Wizard was to switch on "regular" data, which does not vary depending on the physical location where the composition is being performed. It tries to perform an exact match on the field contents (with an option to ignore case-sensitivity), so if you have a field which contains a full file path and name, and that path is being generated in a remote composition environment such as FusionPro Web, then that exact match might not be found. Again, though, that's not really what the Switch Wizard was designed for.

Link to comment
Share on other sites

Also, I'm not sure this is the best solution:

Just copy and paste the content below into the globals and use the "Switch Rule" outlined in the previous post:

 

function matchPathToString(path, stringToMatch)

{

path = ToUpper(path);

stringToMatch = ToUpper(stringToMatch);

 

searchResult = path.indexOf(stringToMatch);

 

if (searchResult > -1)

return true;

 

else

return false;

}

That just tries to match the string anywhere along the path, not necessarily the file name at the end.

 

I think this is a better solution:

function FileNameFromPath(fullPath)
{
 return String(fullPath).replace(/^.*(\\|\/|\:)/, '');
}

If you put that function in your JavaScript Globals, then all you have to do is change the first line in all those Switch Wizard rules which you've converted to JavaScript from this:

switch (Field("Photo").toLowerCase())

to this:

switch (FileNameFromPath(Field("Photo")).toLowerCase())

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...