Quote:

Yes how to implement it, but not the how the modulus works, for those of us without a major in mathematics, it can be difficult to understand without the plain english explanation.




The link provided gives a working script.

As for the maths, it's very simple. You start with a big number (let's call it D), divide by a smaller number (lets call it Q) and take the remainder. The remainder is always going to be between 0 and Q-1. As D increases by 1, so the remainder will increase by 1. This remainder is also known as the modulus.

Here is an example. Lets start D and Q both at 3 and see what the effect of increasing D is:

Quote:

When D is 3 (D mod Q) is 0
When D is 4 (D mod Q) is 1
When D is 5 (D mod Q) is 2
When D is 6 (D mod Q) is 0
When D is 7 (D mod Q) is 1
When D is 8 (D mod Q) is 2
When D is 9 (D mod Q) is 0




So how does this help? Well, assume that "D" represents Date, and "Q" represents "Quotes". This gives us a really simple way of going through the quotes in a linear fashion. All you need to do is get the date in a numeric format.

There are a number of "serial date" functions to convert dates into an internal format that you can use in maths, but you don't really need them.

Here is one very simple way of determining the quote:
Code:
Break ON

$Q=12345 ; Number of quotes
$D=CDbl(Join(Split(@DATE,"/"),"")) ; Convert date to a number

"Number of quotes : "+$Q+@CRLF
"Today : "+@DATE+@CRLF
"Today as a number : "+$D+@CRLF
@CRLF
"Quote for today is : "+($D mod $Q)+@CRLF



See, I told you it was simple

The only drawback to using this method is that some quotes will be skipped on each cycle, however they will be picked up in later cycles so it is not an issue unless you are paranoid about all your quotes being displayed.

Don't forget that the result is between 0 and Q-1.