简体   繁体   中英

IBM Watson Assistant: How to ensure check-out date is after check-in date

I am creating a hotel room booking chat bot using IBM Watson Assistant. How can I make sure (probably with conditions) that the check-out date entered by the client is after the check-in date they entered? Conditions in Watson Assistant can only compare a date relative to a user time and not to the input! The image here process will show the process that I am working on.

You can use context variables or entities.

With context variables, save the dates into context variables. You can then compare the two date context variables, using any of the date comparison methods - https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-methods#dialog-methods-date-time

<? $checkinDate.before($checkoutDate) ?>

If you use entities pulled out from the input, then this will be:

<? @checkinDate.before(@checkoutDate) ?>

You can also mix and match, say you have the checkinDate already (and its in the future) and you have stashed the value in context. Then your next utterance may ask for the checkout date, in which case your check becomes.

<? $checkinDate.before(@checkoutDate) ?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM