Search code examples
javascriptcalculated-fieldwatson-conversation

Math calculation in Watson Conversation response


I am pretty starting some flows and testing, maybe this is a fool question, sorry. I have a flow asking for some inputs (amount, and currency). I want the conversation bot to answer the total (amount * currency). I did several researches, but nothing yet using the "context" section, even storing values in variables, when calling $var1 * $var2, it does not do the math on the response. Any suggestion? Eg: calling a javascript for that? Or what?

Thanks a lot.


Solution

  • You need to tell the conversation service you want to evaluate something as an expression by using <? ?> - in your case this means writing this <? $var1 * $var2 ?> to Watson answer field in the UI.