EasyManua.ls Logo

Omron CX-Supervisor - Report Generation

Omron CX-Supervisor
46 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Coffee Machine scenario SECTION 3 Advanced Tutorial
33
3. Add a button with caption Select File with the following script for selecting
the previously created file (selections.txt):
filename = SelectFile("Text Files (*.txt)|*.txt|All Files (*.*)|*.*||",
"C:\Coffee")
4. Add a button with caption Line Read with the following script for reading
a line of text from the selected file:
aux_text = ""
ReadMessage(filename, fileindex, aux_text, 42)
fileindex = fileindex + 42
5. Add a button with caption Reset Index with the following script for
resetting the cursor to the start of the file:
fileindex = 0
6. Add 3 Text objects with Display animations to display the points filename,
aux_text, and fileindex.
7. Add a 'Close' button with an animation to close the page.
8. Open Main page and add an animation to the "File Handling" button to
display the new page called File.
3-1-12 Report Generation
Data can easily be formatted and exported in a textual report, for example in
.TXT, .RTF or .HTML format. The template file will contain the following text:
DEPOSIT LEVEL REPORT
(("DATE: %s", $Date ))
(("TIME: %s", $Time ))
(("Coffee Level: %d", coffee_level))
(("Water Level: %d", water_level))
(("Milk Level: %d", milk_level))
(("Tea Level: %d", tea_level))
(("Sugar Level: %d", sugar_level))
(("Active Alarms: %d", $ActiveAlarms))
1, 2, 3… 1. Create a file in the project directory called source.txt with the template
text. This template will be evaluated and the values within brackets
formatted at runtime.
2. Make a new page with the following properties
Page Title = Report
Border Style = THICK
Display Mode = POPUP
Top = 0
Left = 505
Height = 582
Width = 295
3. Use the Workspace to remove the Display On Run option from the popup
menu.
4. Add a button with caption Generate Report with the following script for
creating the output report file (report.txt):
GenerateReport("C:\coffee\source.txt","report.txt")

Other manuals for Omron CX-Supervisor

Related product manuals