how do I force a number field to format as a ratio?

  • 0
  • 1
  • Question
  • Updated 2 years ago
  • In Progress
I have a number field that I would like to format as a ratio when the user enters data (e.g. 5:1).
Is there a way to do this in Quickbase?
Photo of Traci S

Traci S

  • 280 Points 250 badge 2x thumb

Posted 2 years ago

  • 0
  • 1
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,224 Points 20k badge 2x thumb
See this:

Number To Fraction ~ Add New Record

Pastie Database

Text Formula with some HTML allowed:
"<img src onerror='this.outerHTML=( function(x) { var tolerance = 1.0E-6; var h1=1; var h2=0; var k1=0; var k2=1; var b = x; do { var a = Math.floor(b); var aux = h1; h1 = a*h1+h2; h2 = aux; aux = k1; k1 = a*k1+k2; k2 = aux; b = 1/(b-a); } while (Math.abs(x-h1/k1) &gt; x*tolerance); return h1+&quot;/&quot;+k1; } )(" & [Number] & ")'>"


(1) Continued Fraction expansion algorithm:

(2) In the formula you could easily convert the "/" to ":" to produce a ratio.

(3) This solution uses the  OEH Technique - the OError HTML Technique named of course after the "Ooo - eeeee - hoo!" chant sung by the Winkie Guards in the Wizard of Oz (that is what they are singing  - it is in the script if you don't believe me):