So, I have a query that returns a number of records. And on my results page I display a line that says: Results 1 to 10 out of 30+ results are shown below.
The 30+ number I get by doing this:
<!--- round to the nearest ten --->
<cfset totalfoundRounded = Round(myquery.recordcount/ 10) * 10>
This works great if my recordcount is for example 34 or less. Or 24 or less, basically as soon as it gets over 5, my code rounds up. So even if there are only 18 records, it will say 20+ records found.
I have been scratching my head on how to get this logic to work, so that it always rounds down to the nearest 10, even if it's 18, or 19.
I tried using int() but that didn't work, it only works on decimal places.
So, is there a function in coldfusion, or some technique I'm missing to get this to work? I have been unable to find anything searching, and math is not my strong point :(
Thank you very much for any suggestions!!
Try this?
<cfset totalfoundRounded = Int(myquery.recordcount/ 10) * 10>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With