Jump to content

OnRecordStart NOK on MarcomCentral


Olivier

Recommended Posts

Hi friends,

I have written a OnRecordStart rule to compose a specific page based on the choice of an image field (Field("Type-flux")).

I have a second condition base on the use of a logo or not.

The rule is working fine on Acrobat with FP 9.3.6 on my Mac, but it is not working a expected when files are upload to the MarcomCentral.

Here is my code :

if (Field("LogoColl2") == "")

{

if (GetFileName(Field("Type-flux")) == "Bi-flux" || GetFileName(Field("Type-flux")) == "Bi-flux projet métal")

{

{

FusionPro.Composition.SetBodyPageUsage("One", true);

}

{

FusionPro.Composition.SetBodyPageUsage("Two", false);

}

{

FusionPro.Composition.SetBodyPageUsage("Three", false);

}

{

FusionPro.Composition.SetBodyPageUsage("Four", false);

}

}

else

{

{

FusionPro.Composition.SetBodyPageUsage("One", false);

}

{

FusionPro.Composition.SetBodyPageUsage("Two", false);

}

{

FusionPro.Composition.SetBodyPageUsage("Three", true);

}

{

FusionPro.Composition.SetBodyPageUsage("Four", false);

}

}

 

}

else

{

if (Field("LogoColl2") != "")

{

if (GetFileName(Field("Type-flux")) == "Bi-flux" || GetFileName(Field("Type-flux")) == "Bi-flux projet métal"

{

{

FusionPro.Composition.SetBodyPageUsage("One", false);

}

{

FusionPro.Composition.SetBodyPageUsage("Two", true);

}

{

FusionPro.Composition.SetBodyPageUsage("Three", false);

}

{

FusionPro.Composition.SetBodyPageUsage("Four", false);

}

}

else

{

{

FusionPro.Composition.SetBodyPageUsage("One", false);

}

{

FusionPro.Composition.SetBodyPageUsage("Two", false);

}

{

FusionPro.Composition.SetBodyPageUsage("Three", false);

}

{

FusionPro.Composition.SetBodyPageUsage("Four", true);

}

}

}

}

}

 

 

Where may be the issue ?

I have used a GetFileName function to collect the name of the selected image, is there something wrong or something else to do ?

 

Thank you all for the assistance.

BR, Olivier.

Link to comment
Share on other sites

It looks like there are too many {}s. Try this.

 

if (Field("LogoColl2") == "")

{

if (GetFileName(Field("Type-flux")) == "Bi-flux" || GetFileName(Field("Type-flux")) == "Bi-flux projet métal")

{

FusionPro.Composition.SetBodyPageUsage("One", true);

FusionPro.Composition.SetBodyPageUsage("Two", false);

FusionPro.Composition.SetBodyPageUsage("Three", false);

FusionPro.Composition.SetBodyPageUsage("Four", false);

}

else

{

FusionPro.Composition.SetBodyPageUsage("One", false);

FusionPro.Composition.SetBodyPageUsage("Two", false);

FusionPro.Composition.SetBodyPageUsage("Three", true);

FusionPro.Composition.SetBodyPageUsage("Four", false);

}

}

else

{

if (GetFileName(Field("Type-flux")) == "Bi-flux" || GetFileName(Field("Type-flux")) == "Bi-flux projet métal"

{

FusionPro.Composition.SetBodyPageUsage("One", false);

FusionPro.Composition.SetBodyPageUsage("Two", true);

FusionPro.Composition.SetBodyPageUsage("Three", false);

FusionPro.Composition.SetBodyPageUsage("Four", false);

}

else

{

FusionPro.Composition.SetBodyPageUsage("One", false);

FusionPro.Composition.SetBodyPageUsage("Two", false);

FusionPro.Composition.SetBodyPageUsage("Three", false);

FusionPro.Composition.SetBodyPageUsage("Four", true);

}

}

Link to comment
Share on other sites

Hi jwhittaker,

tank you it is much more clear like this. Unfortunately the result is still the same, the system online only composes page Three or Four, but never One or Two whatever the Type-flux is.

It looks like the system does not recognize the name of the image selected as Type-flux.

Hope someone will help me.

 

Anyway, thank you !

Link to comment
Share on other sites

Here they are !

Please note all the ressources are not attached, as there are many images in different collections. But the most important are there.

Also note the OnRecordStart rule is working fine on my local Acrobat with FP 9.3.6

Images are available here : https://dl.dropboxusercontent.com/u/109498456/images.zip

 

Best regards,

Olivier

collecteOG.zip

Link to comment
Share on other sites

Olivier

Try using this code for the OnRecordStart

I just created new variable and am searching for the 2 names you are looking for.

 

var typeflux = Str(Field("Type-flux"));

 

if (Field("LogoColl2") == "")

 

{

if ((typeflux.search("Bi-flux") != -1) || (typeflux.search("Bi-flux projet métal") != -1))

{

FusionPro.Composition.SetBodyPageUsage("One", true);

FusionPro.Composition.SetBodyPageUsage("Two", false);

FusionPro.Composition.SetBodyPageUsage("Three", false);

FusionPro.Composition.SetBodyPageUsage("Four", false);

}

else

{

FusionPro.Composition.SetBodyPageUsage("One", false);

FusionPro.Composition.SetBodyPageUsage("Two", false);

FusionPro.Composition.SetBodyPageUsage("Three", true);

FusionPro.Composition.SetBodyPageUsage("Four", false);

}

}

else

{

if ((typeflux.search("Bi-flux") != -1) || (typeflux.search("Bi-flux projet métal") != -1))

{

FusionPro.Composition.SetBodyPageUsage("One", false);

FusionPro.Composition.SetBodyPageUsage("Two", true);

FusionPro.Composition.SetBodyPageUsage("Three", false);

FusionPro.Composition.SetBodyPageUsage("Four", false);

}

else

{

FusionPro.Composition.SetBodyPageUsage("One", false);

FusionPro.Composition.SetBodyPageUsage("Two", false);

FusionPro.Composition.SetBodyPageUsage("Three", false);

FusionPro.Composition.SetBodyPageUsage("Four", true);

}

}

Link to comment
Share on other sites

I'll bet that the issue has less to do with the GetFileName function and more to do with the special character (é) in the field name. It seems like that character might work fine locally on a Mac but could be translated incorrectly on a server (especially if it's a Windows server).

 

You should probably use a function like "TaggedTextFromRaw" to better handle the special characters. It will convert the é to its HTML entity: é

Then you would be able to change your if statement to:

if (TaggedTextFromRaw(Field("Type-flux")) == "Bi-flux" || TaggedTextFromRaw(Field("Type-flux")) == "Bi-flux projet métal")

 

Or using a Regular Expression:

if (!TaggedTextFromRaw(Field("Type-flux")).search(/Bi-flux( projet métal)?/g))

 

And if you really want reduce your code to eliminate the excessive if/else statements, you could change your OnRecordStart rule to look like this:

var flux = TaggedTextFromRaw(Field("Type-flux")).search(/Bi-flux( projet métal)?/g);
pg = [['One','Three'],['Two','Four']][+!!Field("LogoColl2")][+!!(flux)];
FusionPro.Composition.SetBodyPageUsage(pg, true);

Link to comment
Share on other sites

Hey, karen from the Grafix support has sent me the solution...

I was using the GetFileName but thinking it was able to return the user Friendly label…

In fact, in my rule I have to test on the exact file image name, and now it works fine !

 

I will try your code also, and let you know.

 

Best regards,

and thank you all for your assistance.

Olivier

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