How do you get currency to play?

I've tried a bunch of things with ToCurrency and MakeCurrency but cannot get this to work.

What I've got is collecting a payment amount from a caller that they enter, including the cents, ie $125.50 would be entered as 12550. I need to then create a string that's decimalised that so 125.50. But I also want to play that out to the caller as $125.50 specifically. No matter what I do I cannot get that currency piece to work.

Can someone please help me out here as it seems like it should be obvious but I've obviously missed something.

Hi Vaun,

It might help if you include an export of your flow so that others can see exactly what you are trying to do.

--Jason

Hi Jason the issue seems to be specifically around how I use quotes. One of the currency functions looks to require quotes passed in, but I need to include a variable in there. If I put the variable between quote marks then the variable name, not the contents will be passed through and it fails.

Which currency function are you trying to use?

You might be able to build an expression like this to get quotes around a variable value:
"\"" + Call.Ani + "\""

Hi Vaun,

So there are three steps you want to accomplish here. The first step is putting the decimal place into your string. The second step is converting that string to a Decimal. The third step is converting that string to a currency.

For the first step (putting in the period into the string), you could do this:

Append(Left(Flow.userInput, Length(Flow.userInput) - 2), ".", Right(Flow.userInput, 2))

You could use this expression inside of an Update Data action. For accomplishing the second step, you could create a Decimal variable and use this expression as the value to assign, and the string value created by that expression will be automatically converted to a Decimal.

For the third step (converting to a currency):

MakeCurrency(Flow.userInput, "USD")

You can put that into a new currency variable using an Update Data action, or just put it directly into a Play Audio action's Expression sequence item.

If you wanted to do this all in one step, you could use this:

MakeCurrency(
   ToDecimal(
      Append(
         Left(Flow.userInput, Length(Flow.userInput) - 2),
         ".",
         Right(Flow.userInput, 2)
      )
  ),
   "USD"
)

You can put that into a new Currency variable using an Update Data action, or just put it directly into a Play Audio action's Expression sequence item.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.