cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1669
Views
0
Helpful
21
Replies

Custom Java class to validate the date that entered by user

vincent.zheng
Level 4
Level 4

Current I have a CustomDateWithConfirm class which is extend to MBasicDateWithConfirm, to valid the date such as "19900231", the way currently I did is once I get this value, I increment the disconfirmed count, then ask the user to re-enter the date again. The way I want is if user the invalid date, such as 19900231, I  need the way to let CVP know it is Date NoMatch state, and ask user to re-enter again, how can I do this?


By the way I using CVP 10.5

21 Replies 21

janinegraves
Spotlight
Spotlight

In Studio 11.0 there's a utility you can use in the SetValue element to

check if a date is valid.

If you're not on CVP11, then why not just change from Date with Confirm

to a Date element, followed by either the SetValue (11.0) or a and a a

custom java element to check if the date is valid.

If it is valid, use a YesNoMenu to confirm the date with the caller.

If not valid, tell the caller it's not valid, and perhaps increment a

counter, and then either re-collect the Date or transfer to agent.

That is my original thought...

But the problem is if I have another project(s) need the same element, each time I need to add 5 elements, counter, decision, date, audio(for confirm) and yesNoMenu. It seems like not really efficient... That is why I want to write one custome element that once I got invalid date, it increase the nomatch count.

Or is it have better way to make that 5 elements into one??

If you're writing your own element, it'll definitely be more efficient.

If you're already testing if the date is not valid in your custom

element, then why not just have your tag throw a NoMatch event?

Your custom element should be catching that event already.

--

Janine Graves

Cisco Designated VIP

Training the Experts, LLC

Expert Training in CVP, IVR, VoiceXML, and Speech Technologies

617-549-8585

1 Roundys Hill, Marblehead, MA 01945

How to tag the nomatch event? Automatically? Seems like not that case

create a tag

Vincent,

If it's more the cumbersome nature and untidiness aspect of having to insert the same 5 elements everywhere that's the problem, have you tried making them into an element group?  It doesn't fit all situations but it can make things look somewhat neater and more manageable without having to code new elements.

Can you give me an example how to make the element group? Or just like subflow?

Select the elements you want to group.

Right-click on the selection and click on Group Elements.

The selected elements will be reduced to a single one.

You can double click on it to expand it and open the group.

You can also save the group into a pallette folder of your choice for reuse (right click and select Save As).

Let me know if you hit a snag with these steps.

Paul

vincent.zheng
Level 4
Level 4

I just think about that again, if I group the element, it might mess up the nomatch count.

For example, if the max_nomatch is 3, then following situation might be the problem.

User enter "19920231", that is invalid date, should recognized as no match (1st time)

User enter something else again such as "1990020"(CVP can handle that before my validation runs), count as no match 2

and User probably re-enter the date again with one of following above, that should count as no match 3.

Then the program provide following action for max_nomatch.

So I don't know what is the better way to accomplish this...

Grouping shouldn't change the functionality; it's essentially just a way of inserting a copy of a bunch of elements with the interconnection between them hidden.

I know the group will not change the functionality, I just don't know how to handle that case I mentioned above. If I group into one element, I just want the exit_state is done, max_noinput, max_nomatch, and max_disconfirm.

The element group can have the same exit states as the elements

contained in the group. Or you can easily use a Subflow for this.

What version of CVP/Studio do you have?

We are using 10.5

In VoiceXML, if you throw a nomatch event, then it'll go to your nomatch

event handler.

So, in your filled tag, if you determine that the date isn't valid, then

use a VAction to throw a nomatch event.