0

How do I define the 'Number format' as 'Fraction Number' in a number field?

How do I define the 'Number format' as 'Fraction Number' in a number field?

5 replies

null
    • Sean
    • 5 yrs ago
    • Reported - view

    I don't think that's possible with a number field. You'd have to concatenate the fraction to the whole number in a formula field.

    • Sean
    • 5 yrs ago
    • Reported - view

    In my previous post I assumed you wanted to use ¼ instead of .25

    • geral
    • 5 yrs ago
    • Reported - view

    Sean, thank you, I'm afraid I'm not that skilled yet though!…

    • geral
    • 5 yrs ago
    • Reported - view

    …Yes you assumed correctly, that's precisely what I pretend to do.

    • Sean
    • 5 yrs ago
    • Reported - view

    geral, if you want a starting point this might help. This code goes into a formula field...

     

    let myNum := format(Number, "#,###.##0");
    let decLoc := index(myNum, ".") + 1;
    let myDecimal := substr(myNum, decLoc, 3);
    let myFrac := "";
    switch myDecimal do
    case "125":
    (myFrac := "⅛")
    case "25":
    (myFrac := "¼")
    case "375":
    (myFrac := "⅜")
    end;
    myNum := format(Number, "#,###");
    myNum + " " + myFrac

     

    You can add more case statements to test for more decimals. "Number" is just the name of the number field I use in this example. Here are a couple of links you can check out...

     

    https://www.alt-codes.net/fraction-symbols - For the fractions

    https://ninoxdb.de/en/manual/calculations/reference-of-functions-and-language - For the Ninox language reference

Content aside

  • 5 yrs agoLast active
  • 5Replies
  • 2407Views