0

We have an extract from Oracle when looking up the iby_trxn_documents table

The Value (invoice amount) is a string.

Examples are below:

  1. 54380
  2. 19.80

I would like:

  1. 54380 Dollars and 0 Cents
  2. 19 Dollars and 80 Cents

We need to split this string so it is XX Dollars and XX Cents

How can I create logic to split this? I am using an RTF in MS Word.

Any help would be much appreciated!

I have tried:

<?xdoxslt: truncate(PaymentAmount/Value * 1)?>
<?xdofx:floor(format-number:PaymentAmount/Value;’99G999G999’?>
<?format-number:PaymentAmount/Value;’######’?>
<?truncate(format-number:PaymentAmount/Value;’999G999D99’)?>
<?round(format-number:PaymentAmount/Value;’999G999D99’)?>
<?format-number(round(100 * $number) div 100, '#.00')?>

The below working and is now not however as there aren't any '.' in the example above (54380), the query fails where there is no decimal so it doesn't actually work.

<?xdofx:substr(PaymentAmount/Value,1,Instr(PaymentAmount/Value,'.',-1)-1)?>

2 Answers 2

1

If you are using XSLT, you can do:

<xsl:value-of select="floor(Value)"/>
<xsl:text> Dollars and </xsl:text>
<xsl:value-of select="100 * Value mod 100"/>
<xsl:text> Cents</xsl:text>

Demo here.

Sign up to request clarification or add additional context in comments.

Comments

-1

Just try multiplying value by 1.00, this should add the decimal point back where they are missing. Its a standard trick used in eText templates.

<?xdofx:substr(PaymentAmount/Value * 1.00,1,Instr(PaymentAmount/Value,'.',-1)-1)?>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.