X

The Mobile & Digital Assistant Blog covers the latest in mobile and conversational AI development and engagement

TechExchange: How to Ensure Valid User Date Entries in Oracle Intelligent Bots using BotML and a Custom Component

Frank Nimphius
Master Principal Product Manager

article by Frank Nimphius, July 2018

Oracle Intelligent Bots provides a DATE entity that bot designers can use to assign and save dates for later use. Though the DATE entity validates dates by their format, it does not check whether the provided date actually exists.

For example, February 29th only exists in leap years and February 30th does not exist at all. Assigning a date of February 30th is saved as March 2nd, which from a logical perspective appears to be the right thing to do, but from a business perspective may not be what you want.

Given that enforcing valid date entries is important for many businesses, how can you build chatbots that accept date input only if the date really exist? The use of Regular Expression comes to mind, but this is more for detecting valid patterns than a logic that includes leap years and different days in a month. If you cannot use Regular Expressions then the solution obviously needs to be found in JavaScript. A benefit of a JavaScript based solution is hat JavaScript is the programming language of custom components in Oracle Intelligent Bots.

In this article I explain how to create a custom bot component that validates date string entries based on a pre-defined date format and the validness of the actual date. If the date input string has passed validation you can then use the System.MatchEntity built-in component to save the date object in a context variable. Once saved in a context variable, using Apache FreeMarker expressions, you can print the date in any format you like. Sounds interesting? Well it is.

Figure 1: Valid Date

Figure 2: Invalid Date

 

Update note:
 

Oracle Intelligent Bots has been rebranded Oracle Digital Assistant to better describe its capabilities beyond a standard chatbot. To learn more, visit cloud.oracle.com/digital-assistant

Read More

Read Full Article (PDF)

Download Custom Component (ZIP)

 

Related Articles

TechExchange - Custom Component Development in OMCe – Getting Up and Running Immediately

https://blogs.oracle.com/mobile/techexchange%3A-master-oracle-intelligent-bots-backend-integration-with-oracle-mobile-cloud-enterprise-like-a-pro

 

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.