Jump to content

Graphic to change according to value


david.young

Recommended Posts

I have a document that contains overflow pages, depending on how many pages are created a graphic on the page needs to change.

Page one no problem regardless of number of pages created.

Page 2 seems to work as well for a 2 or 3 page doc. Heres the rule placed on overflow page 1

 

if (StringToNumber(Field("NumTransactions")) <= 68)

{

return Resource("OMR_2.pdf");

}

else

{

return Resource("OMR_1.pdf");

}

return "";

 

When a second overflow pages is needed the rule used does not change the graphic correctly. Here's the rule for overflow page 2

 

if ((StringToNumber(Field("NumTransactions")) > 68) && (StringToNumber(Field("NumTransactions")) <= 102))

{

return Resource("OMR_2.pdf");

}

else

{

return Resource("OMR_1.pdf");

}

return "";

 

What's wrong with the logic I am using?

 

Thanks

Dave Young

FP 5.8 Windows XP

Link to comment
Share on other sites

I am a bit of a novice, but I am guessing that the first part of your rule does not need the "Else" statement.

 

I think that Fusion Pro does not see any of your rule past that first "Else" statement because it covers all scenarios.

 

Not sure how to explain it, hope I am making sense.

 

To test it, just remove:

 

else

{

return Resource("OMR_1.pdf");

}

return "";

Link to comment
Share on other sites

Thanks for the suggestion but as soon as I remove that line and click validate it errors with "Function does not return a value"

 

I did try something this morning, in Preview Record Selector palatte I scrolled to the first record that should have three pages. The value of NumTransactions is 97. At this point I went to the rules editor and tried to validate the rule for page three and it validated and said it should return OMR 2.

But when I compose a pdf that same record is incorrect OMR 1 is used.

 

Any more ideas?

Link to comment
Share on other sites

I just re-read your rule. What is the different results desired between the first section of the rule and the second? They both seem to be returning the result of OMR_2.pdf.

 

It seems redundant to me.

 

1st section is saying: if number is less than or equal to 68, return OMR_2.pdf.

 

2nd section is saying: if number is 69 to 102, return OMR_2.pdf.

 

Why not just say: If number is less than 103 return OMR_2.pdf, else return OMR_1.pdf?

Link to comment
Share on other sites

I'm confused by the 3rd return in each rule which returns nothing? It would seem that if the nth page is required due to overflow, the document will either end with that page (OMR_2.pdf), or continue to another page (OMR_1.pdf). Can you remove the last line from each rule and see what happens?

 

I know this is a dumb question, but are you sure you have the correct rule applied on each page (as opposed to copying the same rule into each page)?

Link to comment
Share on other sites

Eric,

Alas deleting the third return doesn't help either. Note, I started these rules using the rule wizard and then converted to JavaScript, the third return was then there.

No dumb questions, I have gone back in and redrawn the graphic box on each page and then applied the appropriate rule. Whats got me so screwed up is all the 2 page docs work perfectly and the 3 page doc pages 1 and 2 are correct and then it fails on page 3.

I really did'nt think that this would be that hard.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...