I'm currently working on a CVP Studio app to record emergency messages with a timeout, and I'm running into something very frustrating with the Math element: It always outputs its results as a float! So for example I'll add 2 hours to the current time's hour, and get "12.0" instead of "12". I'd like to take the ".0" off of these results, but I don't see any way to do this without doing custom Java. Even using a Data tab to record the value into an Integer, it still keeps the ".0" on the data.
Here's a couple lines from the activity log... first one is the Math element, the second is the data tab of an Application Modifier storing the result into an Integer:
Anyone know a way to keep the ".0" out without building custom Java for this?
See the description of the Math element.
It shows that the result is a Double value and the result of 2*4 = 8.0
Yes, I noticed that.
I guess my question is more along the lines of: Is there any way to change the double value to an integer using something else in CVP Call Studio? I would have expected that storing the value into Session Data as type Integer would store 8.0 as 8, but it doesn't appear that way in the activity log.
If you're always subtracting an integer from an integer, you could use a Counter element. Use the Settings tab to set the function to Decrement, and use variables for the Initial Count and the Step size. The result will be an Integer and stored into Element data. You can then use the Data tab to assign that value into your own Session variable.
Hope that helps.
That works perfectly, Janine! Thanks for your help.