We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics

No Match - Not only Comparing length but also input value

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
headpill
Posts: 40
Joined: Mon Aug 17, 2015 9:34 pm

No Match - Not only Comparing length but also input value

Post by headpill »

Hello Support,

I am trying to do something which i achieved but trying to understand if that can be done smartly.
For e.g, in one of my form i am asking user to input Number of Years for renewal of insurance and it can be between 1-5 years only,

So, i am putting <field name="myfield" type="digits?length=1"> like this, and if user enters anything more than one digit then its throwing error which is understood because it is matching length.
But for between 1-5 years i have to write if condition to compare the input from a fixed value. and if the "myfield" is not between 1-5 i have to throw error and also i have to limit the retires on wrong number of inputs to 3 times. Length was handled by no match, if wrong single digit input can be handled in no match also, that would be great.

Is there anyway i can put the condition for inserting digit only bewteen 1-5 in this node itself -

<field name="myfield" type="digits?length=1">

that way i can save lot of code for No match no input and comparison. Reason why, i have same kind of logic to applied in many places in this VXML.

Please guide if that is possible or any other smart way to handle this.

Thank You so much.

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

Re: No Match - Not only Comparing length but also input valu

Post by support »

Hello,

By using grammar, you are able to give the user an option to choose from (Please see code below). If however, the user doesn't select an item that is available, it will call the nomatch error.

Code: Select all

<grammar type="application/srgs+xml" root="ROOT" mode="dtmf">
 <rule id="ROOT">
      <one-of>
        <item>1</item>
        <item>2</item>
        <item>3</item>
        <item>4</item>
        <item>5</item>
      </one-of>
 </rule>
</grammar>
If the user continues to provide an invalid number, you can change the counter to 3 by adding count="3". Once user makes it to no match on the third time, you can have it do whatever you want.

Code: Select all

<nomatch cond="true" count="3">
  ------ your code here -----
</nomatch>
Hope this helps.

Regards,
Plum Support

headpill
Posts: 40
Joined: Mon Aug 17, 2015 9:34 pm

Re: No Match - Not only Comparing length but also input valu

Post by headpill »

Ok, I was suspecting that i may have to do something with Grammar, Thank you so much for confirming this approach.

Post Reply