Project

General

Profile

Usage

There are two ways to use Fractions and four main methods:

  • in methods
    • getDecimalFromFraction(fraction)
    • getFractionFromDecimal(dec)
  • in field formatters
    • convertDB2Fraction(databaseValue)
    • convertFraction2DB(displayedValue)

Code examples

 var myDecimal = scopes.FRACTIONS.getDecimalFromFraction("3 1/2")  // returns 3.5
 var myFraction = scopes.FRACTIONS.getFractionFromDecimal(3.5)  // returns "3 1/2" 

Field formatter example

Click on the format property value of a decimal field (ie: storage type of real/decimal/etc) with a display type of TEXT_FIELD. In the popup dialog, choose "Use a UI converter" and fill out the values per the following screen shot:

This will enable a field to display backend decimals as fractions as well as allow data entry with fractions to be stored as decimals.