Page 1 of 1

application.lastresult is not working

Posted: Fri Feb 19, 2016 2:55 am
by aravindm
Hi,

Shadow variables is not working for me. It always throws error.semantic.ECMAscript error. please help to resolve it.

Code: Select all

<form id="frm_test">
<field name="fld_test"  type="digits?length=3">
<prompt> Enter 3 digit code </prompt>
<filled>
         <value expr="fld_test" />
         <disconnect />
</filled>
<nomatch>
	<log> Nomatch value:::  <value expr="application.lastresult$[0].utterance" /></log>
         </reprompt>
</nomatch>
<noinput>
         <reprompt/>
</noinput>
</field>
</form>

Re: application.lastresult is not working

Posted: Fri Feb 19, 2016 9:57 am
by support
Hi,

Firstly, you will never be able to utilize the shadow varaible for an input field within a <nomatch> or <noinput> tag. Reason being, if a nomatch or noinput event occurs, the field was never populated, as the grammar was not matched. That explains the error you ere hearing and you should have seen in your logs something similar to:

Code: Select all

TypeError: fld_test$ has no properties line 1
errno: 1 exception Caught failure while attempting to evaluate an embedded value
This is essentially saying what I explained above, that the variable has no properties and therefore has no .utterance property as well, which is the cause of the ecmascript error.

One additional thing to note is that you can utilize the shadow variables by variable names. For example, you could log the utterance in your script like such:

Code: Select all

<?xml version="1.0"?>
<vxml version="2.0">
<form id="frm_test">
  <field name="fld_test"  type="digits?length=3">
    <prompt> Enter 3 digit code </prompt>
    <filled>
	  <log>value:::  <value expr="fld_test$.utterance" /></log>
      <value expr="fld_test" />
      <disconnect />
    </filled>
    <catch event="nomatch noinput">
      <reprompt/>
    </catch>
  </field>
</form>
</vxml>
This will log the utterance spoken by the caller, when a match is supplied.

Hopefully that helps, please let us know if you have any additional questions.

Regards,
Plum Support

Re: application.lastresult is not working

Posted: Fri Mar 04, 2016 6:35 am
by aravindm
For reporting purpose, i need to capture the digits entered by the user. The digits may not satisfy the grammar rule. I tried application.lastresult$[0].utterance in nomatch event which is not working. Please let me know is there any other way to capture the user entered digits.

Re: application.lastresult is not working

Posted: Wed Mar 09, 2016 4:34 pm
by support
Hello aravindm,

The only way to achieve what you are looking to do would be to use an open ended grammar and then explicitly verify the range and values for what you have set in the <filled> block. Then anything that doesn't match what would be the "invalid" input you're looking to capture.

We don't recommend this though as it introduces unnecessary complexity over predefined grammars and could cause new errors for you.

Regards,
Plum Support