An Oracle blog about BI Publisher

  • RTF
    April 11, 2013

Variable Numbers to Words

Satyender posted a comment to the Numbers to Words post asking:
How can I store the result of <?xdofx:to_check_number(TOTAL_INV_AMOUNT,'USD','CASE_UPPER','DECIMAL_STYLE_WORDS')?> inside a variable.

Checking this out, BIP chokes on the assigning to the variable with a nice error:

 Namespace prefix 'xdofx' used but not declared

Turning to BIP RTF template guru in residence Hok-Min, he suggested avoiding the xdofx: wrapper altogether in this case and calling the function more directly. The underlying function in java is:

public static String toCheckNumber(String locStr, String amount,
String preOrCurCode, String caseStyle, String decimalStyle)

Applying that to Satyender's needs we end up with:

<?variable@incontext:salval; xdoxslt:toCheckNumber($_XDOLOCALE,.//SALARY,'USD'

We still need the xdoxslt prefix but we can now assign the value to a variable. There is a caveat from Hok Min.

Note that the amount has to be in string format.  If it is not a string,
it has to be converted to a string, e.g.
string($CALCULATED_SALARY).  If you use XML element name directly
(like in this case SALARY), then it is already a string, so no
need to do conversion.

I know this raises the question of why do we need the xdofx: prefix at all? Im discussing that with Hok Min as I write and will get back to you.

Join the discussion

Comments ( 1 )
  • guest Tuesday, July 30, 2013

    <?xdoxslt:toCheckNumber($_XDOLOCALE, TOTAL_AMOUNT+ xdoxslt:get_variable($_XDOCTX,'valuesum1'),'USD','CASE_UPPER','DECIMAL_STYLE_WORDS')?>

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.