VaunMcCarthy | 2020-08-16 05:20:45 UTC | #1
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.
Jason_Mathison | 2020-08-17 12:57:32 UTC | #2
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
VaunMcCarthy | 2020-08-18 03:46:29 UTC | #3
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.
Jason_Mathison | 2020-08-18 15:33:27 UTC | #4
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 + "\""
anon99530797 | 2020-08-25 14:13:07 UTC | #5
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.
system | 2020-09-25 14:13:10 UTC | #6
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 8580