Coffee Machine scenario SECTION 3 Advanced Tutorial
34
5. Add a button with caption View Report with the following script for
launching an associated viewer:
ViewReport("C:\coffee\report.txt")
6. Add a button with caption Edit Report with the following script for loading
the template into an installed editor:
EditFile("C:\coffee\source.txt")
7. Add a 'Close' button with an animation to close the page.
8. Open Main page and add an animation to the "Report Generation" button
to display the new page called Report.
Creating HTML reports:
1, 2, 3… 1. Create a file in the project directory called source.htm with the template
text. If using Word or more powerful html editor, feel free to experiment
with different fonts, font sizes and colours etc.
2. Add 3 buttons to Generate, View and Edit the report as per the text
example.
3-1-13 Database Access
We will add the facility to write the ingredients used to a standard database,
and add a page to read through records previously written. First we must
create the database template using Microsoft Access. Please consult your
Microsoft documentation for full details of these operations. If you do not have
Microsoft Access, you can still read and write Access files from CX-Supervisor
but you will need to copy a database file from the demo folder to use as a
template. Alternatively you can use any other ADO compatible data source,
with suitable changes to the connection details.
Add the point required by this step.
1, 2, 3… 1. Launch Microsoft Access and create a new database called coffee.mdb
in the project directory C:\Coffee.
2. Create a new table, in Design View if prompted.
3. Insert six new Fields and rename them as per the table below.
4. Open the table Design, and configure the data type and field size from the
table below.
5. Save the table as Ingredients, without an index if prompted
6. Close Microsoft Access, saving any changes.
Point name Point type Default
Value
Description (optional)
record_index Integer Index to current database
record
Field Name Field Data Type Field Size
Selection Memo -
Coffee Number Integer
Water Number Integer
Milk Number Integer
Tea Number Integer