开发者

Increment a counter in VXML

开发者 https://www.devze.com 2022-12-23 05:07 出处:网络
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'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>   
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号