AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Using system variables with tables
 
 

I’m trying to program my bot to respond to questions about hours of operation. I have a table with dates and the hours of operation:

tablehours (^today ^hrs)

DATA:
"5 23 2012" "open from 8:00 am until 8:00 pm"
"5 24 2012" "open from 8:00 am until 8:00 pm"
"5 25 2012" "open from 8:00 am until 1:00 pm"
"5 26 2012" 
closed
"5 27 2012" closed
etc
etc

but am stuck on how to create the first argument. I tried:


table: hours (^datecheck ^hrs)
$datecheck = ^createfact(%month

 

 
  [ # 1 ]

As always, there are a variety of ways to do this. I’m not sure the year is really a relevant concern in your table, but fine.


GRRR—- I put in code here, it shows fine in preview, and disappears in my actual post.

The basics I wrote were: use periods instead of spaces in your first argument (fractionally simpler). Then use createfact(^1starg open ^2ndarg) as the table build.

Retrieve with $$tmp = join( month . date and year ) then
query(direct_sv $$tmp open ?)

 

 
  [ # 2 ]

You were trying to PARSE your date string into pieces to build a fact. But the string itself is a fine value.
OTHERWISE, you would not use a string. you would make table data like this:
5 12 2012 “closed”

Of course, you COULD parse the string by bursting it:
_0 = burst(^today ” “)
and then you should have pieces _0 _1 and _2.
but then you are back to creating multiple facts when a single fact per entry would do.

 

 
  [ # 3 ]

Thanks! That did it!

 

 
  login or register to react