Jump to content

Sequential Numbering with Variable Backs


markriley

Recommended Posts

Posted

I've got a project in the works that is stumping me so far.

 

A local park will be issuing parking passes this summer. They have sold advertising for the back of the passes. There a 9 versions (ads) for the backs.

The fronts are static with the exception of a sequential number.

 

They want Ads 1-9 to be with Sequential #'s 1-9 and then start at the beginning with Ad 1 for #10, Ad 2 for #11and so on. This way the Ads get dispersed in a somewhat "even" fashion.

 

I have the backs as separate files so they can be called in with a rule I'm just not sure how to tell FP to "restart" my data list when it hits the end after every 9 records.

 

Any help would be greatly appreciated.

 

thanks in advance!

 

Mark Riley

Posted
Mark- Just use the Mod function in FP. Mod will return the remainder, for example, 10 Mod 9 will return 1. This way you will only get 0-8 as possible results.
Posted
Mark- Just use the Mod function in FP. Mod will return the remainder, for example, 10 Mod 9 will return 1. This way you will only get 0-8 as possible results.

That is indeed the correct answer. However, there's no "Mod function." You need to use the modulus operator (the percent sign) to get the remainder:

https://developer.mozilla.org/en/JavaScript/Reference/Operators/Arithmetic_Operators#.25_%28Modulus%29

 

Please see this thread for an example:

http://forums.printable.com/showthread.php?t=1256

Or do a forum search for "modulus".

 

Specifically, you probably want something like this:

var AdNumber = (CurrentRecordNumber() - 1) % 9 + 1;

Archived

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

×
×
  • Create New...