Playing Minor Currencies

Document created by cdnadmin on Jan 25, 2014
Version 1Show Document
  • View in full screen mode
This document was generated from CDN thread

Created by: Binny Mathew on 24-01-2013 07:48:56 AM
I am trying to voice an amount (e.g. 10.21) as 10 Dollars and 21  cents using Create Container Prompt.
 
So the syntax would be something like 
 
BalanceFlashFinal_PP=P[strPromptPath+"5.wav"]+dblBFAvailableCreditLimitVal + CurrencyCode;
 
Where BalanceFlashFinal_PP is an object of type Prompt and dblBFAvailableCreditLimitVal  is the value that i need to play of the type double and CurrencyCode is the Currency Type which would be populated dynamically.
But in this case it will play "Ten point twelve Dollars". I need this to play as "Ten Dollars and 12 cents"
Any help is much appreciated  
Rgds/Binny

Subject: RE: Playing Minor Currencies
Replied by: Binny Mathew on 24-01-2013 10:50:03 AM
Thanks Steven for your help!
 
I had tried that and it also works fine. My requirement was to play a series of prompts wherein some parts of the prompts will be Currencies,date,time..
So wanted to use Create Container Prompt. But now i have achieved the same writing a Base package and invoking it whenever required.
 
Also Steven i need to build a Dynamic Menu with UCCX 
i.e Prompts and relevant grammar can be enabled/disabled based on some conditions. Is there any way that i can achieve this. 
 
Will raise it as a different message as the topic of this message is not relevant for this but if you can just suggest on ways to achieve this it would be helpfull.
 
Binny

Subject: RE: Playing Minor Currencies
Replied by: Steven McGoff on 24-01-2013 10:23:43 AM
Hi Binny,
 
You should use a Generate Prompt Step and split the value into dollars and cents.  Within the step you'd use a Generator type as currency, constructor type of (dollar, cent).
 
The dollar value would be dblBFAvailableCreditLimitVal.intValue().
The cents is more involved (to reduce the size of the expression I'm using double instead of the variable name):
Cents is of type int
cents.valueOf(double.toString(double).indexOf(',')+1)
Derived from below.  I haven't tested it, but it should work with this or something similar.
String numberStr = Double.toString(number); String fractionalStr = numberStr.substring(numberStr.indexOf('.')+1); int fractional = Integer.valueOf(fractionalStr);
 

Attachments

    Outcomes