Page 1 of 1

if condition within catch block

Posted: Thu Sep 02, 2010 2:59 am
by sniemetz
Hello

I am trying to have conditional logic within a catch block - depending on whether values are set I want to fork the decision - however this doesn't seem to work.
Suggestions?

<field name="thisfield">
<catch event="connection.disconnect.hangup">
<var name="var1"/>
<if cond="typeof thisfield$ !='undefined'">
<assign name="var1" expr="'choice 1'"/>
<else/>
<assign name="var1" expr="'choice 2'"/>
</if>
<submit namelist="var1" .............. />
</catch>
</field>

Re: if condition within catch block

Posted: Thu Sep 02, 2010 8:14 am
by support
Hi,

You can certainly implement conditional logic within a catch block in your VXML code. The only issue we noticed with the code snippet you posted was that you must surround your <field> with a <form> such as:

Code: Select all

<form>
<field name="thisfield">
<catch event="connection.disconnect.hangup">
<var name="var1"/>
<if cond="typeof thisfield$ !='undefined'">
<assign name="var1" expr="'choice 1'"/>
<else/>
<assign name="var1" expr="'choice 2'"/>
</if>
<submit namelist="var1" .............. />
</catch>
</field>
</form>
Hope this helps!

Regards,
Plum Support

Re: if condition within catch block

Posted: Fri Sep 03, 2010 1:42 am
by sniemetz
AArrgh.

I will retry. Just noticed in Log that the values I am looking for ARE being set - I just omitted them from the submit namelist!

THanks for the prompt response.

s