Most of the time, ideas for new report functions come from customers with unique reporting needs. But every now and then, we stumble upon something ourselves.
As it happens, I was monitoring a help site one day where I occasionally contribute support. One of the posts wasn't asking for help, but was offering a small function. This function turned a number into a fraction. I saw that and realized that people could use that on certificates to pretty up the number of CEUs and other numerical fields.
When .021 was released, NUM2FRACTION rolled out with it. You can pass any numeric field as a parameter like num2fraction(coceus). If a course has 1.75 CEUs, then it will show 1 3/4.
There is a second parameter to the function that is optional. It adjusts the sensitivity of the fraction generated. By default, the sensitivity is .000001. So if you have 0.333 CEUs, then NUM2FRACTION is going to show it as 333/1000. But if you pass .001 as the sensitivity, like NUM2FRACTION(.333,.001), then you will get 1/3 as the result.
Another useful function for prettying up numbers on a certificate is NUM2STR, which was started by Lindsey and Chuck, and was used to spell out numbers between 0 and 20. It was later expanded to numbers as high as one quadrillion.
NUM2STR only uses one parameter: Any number or number field that you want to convert. For example: If you have 20 hours on a course, then NUM2STR(cohours) will display the hours as Twenty. You can also use it with a specified value, like NUM2STR(9999999), which will display Nine Million Nine Hundred Ninety-Nine Thousand Nine Hundred Ninety-Nine. Please don't pass numbers above one quadrillion as you will just get a message that the number too large; numbers in the hundreds of trillions or less will work best.
As always, ask your tech if you need help adding one of these functions to a report. For more examples, visit our help guide. If you have any other function suggestions, drop me an email at firstname.lastname@example.org.
Contributed by Matthew J. Olson