Increment a counter in VXML
I'm sorry that this is probably a really basic question but I'm just beginning to program. Basically I need to increment a counter in VXML.
I've declared the counter as:
<var name="i" expr="0" />
and in开发者_如何学JAVA an IF statement I've incremented by doing this: the second assign tag increments the counter.
<if cond="the_aveland_high_school"> <prompt> Thank you I have recognised a school</prompt> <assign name="arrEmpty[i]" expr="'the_aveland_high_school'"/> <assign name="i" expr="++"/> </if>
Is that concept correct?
Thanks for any help!
I think information was left from your question. I believe you asked if:
<var name="counter" expr="0"/>
...
<if ...>
<assign name="counter" expr="counter+1"/>
Yes, that is one way to increment a counter. You can also perform your logic directly in ECMAScript within a element.
<vxml version="2.1" application="tellmeu_root.vxml">
<var name="iStudentID" />
<var name="iStudentPIN" />
<var name="iRetries" expr="1" />
<catch event="event.retry_login">
<prompt>Invalid i d or password</prompt>
<assign name="iRetries" expr="iRetries+1" />
<if cond="iRetries == giMaxLoginRetries">
<throw event="event.login_retries_exceeded" />
</if>
<goto next="#get_id" />
</catch>
精彩评论