Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The following api. functions are available:

Name and Link to API Doc

Code Example

attributedResult

Code Block
languagegroovy
def cost = api.getElement("MarginPct")
 def myOptions = ["A" , "B" , "C" ]
 return api.attributedResult(cost)
         .withBackgroundColor(cost < 0.30 ? "red" : "#0101DF")
         .withSuffix(cost < 0.30 ? "!!!" : null)
         .withTextColor(cost < 0.30 ? "white" : null)
         .withTextDecoration(cost < 0.30 ? "underline" : null)
         .withManualOverrideValueOptions(myOptions)

formatNumber

Formats a number into a string.

Code Block
languagegroovy
api.formatNumber("###.##",length)
Syntax with 2 parameters
Code Block
String formatNumber(String pattern, Object n);

Formats a number into a string. Same semantics as {@link java.text.NumberFormat} and {@link java.text.DecimalFormat#applyPattern}

@param pattern The pattern string
@param n The number to format
@return The formatted number as string

Syntax with 3 parameters
Code Block
String formatNumber(String locale, String pattern, Object n);

Formats a number into a string. Same semantics as {@link java.text.NumberFormat} and {@link java.text.DecimalFormat#applyPattern}

@param pattern The pattern string
@param n The number to format
@param locale The locale to use for formatting
@return The formatted number as string

formatString