Hello, Shin-Yu Wu, and welcome to chatbots.org!
What it seems that you’re looking for is a pair of tags, called <set> and <get>. you can see how it would work in the following example:
<category>
<pattern>* CHANGE * APPOINTMENT</pattern>
<template>Sure, Please tell me your name, so that we can get started.</template>
</category>
<category>
<pattern>MY NAME IS *</pattern>
<that>* please tell me your name *</that> <!-- this is an important part of the process, to make sure the proper context is used -->
<template>
<set name="clientname"/> <!-- this stores the information for later -->
Great! I got your name. now what is your ID, please?
</template>
</category>
<category>
<pattern>MY ID IS *</pattern>
<that>* WHAT IS YOUR ID *</that>used -->
<template>
<set name="clientid"/> <!-- this stores the information for later -->
Thanks. Now I just need your BOD.
</template>
</category>
<category>
<pattern>MY BOD IS *</pattern>
<that>* NEED YOUR BOD *</that>used -->
<template>
<set name="clientbod"/> <!-- this stores the information for later -->
Thank you for that. Now which appointment did you wish to change?
</template>
</category>
<!-- now for a simple category to demonstrate how to obtain the stored data: -->
<category>
<pattern>GETBOD</pattern>
<template>Your BOD is <get name="clientbod"/>.</template>
</category>
That’s all I have time for, now. If you have any questions, please feel free to ask.