Professional Documents
Culture Documents
1.
Safety instructions
This manual contains instructions you need to follow for your personal safety and to prevent damage
to property. Instructions for your personal safety are highlighted with a red warning icon. Notes on
possible damages show up with a yellow alert symbol. Depending on the danger level, the warnings
are shown as follows:
1.1.
Warning
Warning! means that death or serious injury can occur if the proper precautions are not taken.
1.2.
Caution
Caution! means that a minor to moderate injury or damage to property can occur if the proper
precautions are not taken.
1.3.
Note
Note! indicates that an unintended result or situation can occur if the corresponding
information is not heeded. If more than one degree of danger is present, the warning notice
representing the highest degree of danger will be used. If the warning note warns about personal
injury, damage to property may be included in the same warning note in addition.
1.4.
Qualified Personnel
PLC Reports as well as the associated system may only be set up and operated in conjunction with
this documentation. Commissioning and operation must only be performed by qualified personnel.
Qualified personnel in the sense of the safety notes in this documentation are persons who are
authorized to start up, identify and document machines and systems in accordance with the
standards of safety technology.
1.5.
Intended Use
1.6.
Brands
All names identified with the sign are registered trademarks of SIS Industrial Software GmbH. Other
product names used in this publication may be trademarks whose use may infringe upon the rights of
the owner.
1.7.
Disclaimer
We have checked the contents of this document to ensure consistency with the software.
Nevertheless, deviations to the described software cannot be precluded entirely. The information in
this manual is reviewed regularly. Necessary corrections will be included in subsequent editions.
2.
1.
Table of Contents
Safety instructions ......................................................................................................................2
1.1.
Warning ..............................................................................................................................2
1.2.
Caution................................................................................................................................2
1.3.
Note ....................................................................................................................................2
1.4.
1.5.
1.6.
Brands .................................................................................................................................3
1.7.
Disclaimer............................................................................................................................3
2.
3.
General ..................................................................................................................................... 16
4.
5.
4.1.
Description ........................................................................................................................ 17
4.2.
Parameters ........................................................................................................................ 18
4.2.1.
4.2.2.
4.2.3.
4.2.4.
4.2.5.
4.3.
4.4.
4.5.
Description ........................................................................................................................ 22
5.2.
Parameters ........................................................................................................................ 22
5.2.1.
5.2.2.
5.2.3.
5.2.4.
Parameter 4: Timestamp Mode or Index of the Batch Begin Timestamp Variable ....... 22
5.2.5.
5.3.
5.4.
5.5.
6.
7.
8.
Description ........................................................................................................................ 25
6.2.
Parameters ........................................................................................................................ 25
6.2.1.
6.2.2.
6.2.3.
6.2.4.
6.3.
6.4.
6.5.
Description ........................................................................................................................ 28
7.2.
Parameters ........................................................................................................................ 28
7.2.1.
7.2.2.
7.2.3.
7.3.
7.4.
7.5.
Description ........................................................................................................................ 32
8.2.
Parameters ........................................................................................................................ 32
8.2.1.
9.
8.3.
8.4.
8.5.
Description ........................................................................................................................ 33
9.2.
Parameters ........................................................................................................................ 33
9.2.1.
9.3.
9.4.
9.5.
10.
10.1.
Description .................................................................................................................... 34
10.2.
Parameters .................................................................................................................... 34
10.2.1.
10.3.
10.4.
10.5.
11.
11.1.
Description .................................................................................................................... 35
11.2.
Parameters .................................................................................................................... 35
11.2.1.
11.3.
11.4.
11.5.
12.
12.1.
Description .................................................................................................................... 36
12.2.
Parameters .................................................................................................................... 36
12.2.1.
12.2.2.
12.2.3.
12.2.4.
12.3.
12.4.
12.5.
13.
13.1.
Description .................................................................................................................... 38
13.2.
Parameters .................................................................................................................... 38
13.2.1.
13.3.
13.4.
13.5.
14.
14.1.
Description .................................................................................................................... 40
14.2.
Parameters .................................................................................................................... 40
14.3.
14.4.
14.5.
15.
15.1.
Description .................................................................................................................... 42
15.2.
Parameters .................................................................................................................... 42
15.3.
15.4.
15.5.
16.
16.1.
Description .................................................................................................................... 43
16.2.
Parameters .................................................................................................................... 43
16.2.1.
16.3.
16.4.
16.5.
17.
Compare Variable.................................................................................................................. 45
17.1.
Description .................................................................................................................... 45
17.2.
Parameters .................................................................................................................... 45
17.2.1.
17.3.
17.4.
17.5.
18.
18.1.
Description .................................................................................................................... 47
18.2.
Parameters .................................................................................................................... 47
18.2.1.
18.2.2.
18.3.
18.4.
18.5.
19.
19.1.
Description .................................................................................................................... 48
19.1.1.
19.1.2.
19.2.
Parameters .................................................................................................................... 48
19.3.
19.4.
19.5.
20.
20.1.
Description .................................................................................................................... 50
20.2.
Parameters .................................................................................................................... 50
20.3.
20.4.
21.
21.1.
Description .................................................................................................................... 51
21.2.
Parameters .................................................................................................................... 51
21.3.
21.4.
21.5.
22.
Exit ........................................................................................................................................ 52
22.1.
Description .................................................................................................................... 52
22.2.
Parameters .................................................................................................................... 52
22.3.
22.4.
22.5.
23.
23.1.
Description .................................................................................................................... 53
23.2.
Parameters .................................................................................................................... 53
23.2.1.
23.3.
23.4.
23.5.
24.
Go To .................................................................................................................................... 55
8
24.1.
Description .................................................................................................................... 55
24.2.
Parameters .................................................................................................................... 55
24.2.1.
24.3.
24.4.
24.5.
25.
Go To If No ............................................................................................................................ 56
25.1.
Description .................................................................................................................... 56
25.2.
Parameters .................................................................................................................... 56
25.2.1.
25.3.
25.4.
25.5.
26.
Go To If Yes ........................................................................................................................... 57
26.1.
Description .................................................................................................................... 57
26.2.
Parameters .................................................................................................................... 57
26.2.1.
26.3.
26.4.
26.5.
27.
27.1.
Description .................................................................................................................... 58
27.2.
Parameters .................................................................................................................... 58
27.3.
27.4.
27.5.
28.
Print Report........................................................................................................................... 59
28.1.
Description .................................................................................................................... 59
28.2.
Parameters .................................................................................................................... 59
28.2.1.
28.2.2.
28.3.
28.4.
28.5.
29.
29.1.
Description .................................................................................................................... 61
29.2.
Parameters .................................................................................................................... 61
29.2.1.
29.2.2.
29.2.3.
29.2.4.
29.3.
29.4.
29.5.
30.
30.1.
Description .................................................................................................................... 63
30.2.
Parameters .................................................................................................................... 63
30.2.1.
30.2.2.
30.2.3.
30.2.4.
30.3.
30.4.
30.5.
31.
31.1.
Description .................................................................................................................... 66
31.2.
Parameters .................................................................................................................... 66
31.2.1.
31.2.2.
31.2.3.
Parameter 3: Error Message if the Batch ID Was Not Found in the Archive................. 66
31.3.
31.4.
31.5.
32.
32.1.
Description .................................................................................................................... 68
32.2.
Parameters .................................................................................................................... 68
10
32.2.1.
32.3.
32.4.
32.5.
33.
33.1.
Description .................................................................................................................... 70
33.2.
Data Provider................................................................................................................. 70
33.3.
Parameters .................................................................................................................... 71
33.3.1.
33.3.2.
33.3.3.
33.3.4.
33.3.5.
33.4.
33.5.
33.6.
34.
34.1.
Description .................................................................................................................... 75
34.2.
Data Provider................................................................................................................. 75
34.3.
34.4.
Parameters .................................................................................................................... 76
34.4.1.
34.4.2.
34.4.3.
34.4.4.
34.4.5.
34.5.
34.6.
34.7.
35.
35.1.
Description .................................................................................................................... 79
35.2.
Parameters .................................................................................................................... 79
35.2.1.
35.2.2.
35.2.3.
35.2.4.
35.2.5.
35.3.
35.4.
35.5.
36.
36.1.
Description .................................................................................................................... 83
36.2.
Parameters .................................................................................................................... 83
36.2.1.
36.2.2.
36.3.
36.4.
36.5.
37.
37.1.
Description .................................................................................................................... 85
37.2.
Parameters .................................................................................................................... 85
37.2.1.
37.3.
37.4.
37.5.
38.
38.1.
Description .................................................................................................................... 86
38.2.
Parameters .................................................................................................................... 86
38.2.1.
38.3.
38.4.
38.5.
39.
39.1.
Description .................................................................................................................... 87
39.2.
Parameters .................................................................................................................... 87
39.2.1.
39.3.
39.4.
39.5.
40.
40.1.
Description .................................................................................................................... 89
40.2.
Parameters .................................................................................................................... 89
40.2.1.
40.3.
40.4.
40.5.
41.
41.1.
Description .................................................................................................................... 91
41.2.
Parameters .................................................................................................................... 91
41.2.1.
41.2.2.
41.3.
41.4.
41.5.
42.
42.1.
Description .................................................................................................................... 93
42.2.
Parameters .................................................................................................................... 93
42.3.
42.4.
42.5.
43.
43.1.
Description .................................................................................................................... 94
43.2.
Parameters .................................................................................................................... 94
43.2.1.
43.2.2.
43.2.3.
43.2.4.
43.2.5.
43.2.6.
43.2.7.
43.2.8.
43.2.9.
43.2.10.
43.3.
43.4.
43.5.
44.
44.1.
Description .................................................................................................................... 96
44.2.
Parameters .................................................................................................................... 96
44.2.1.
44.3.
44.4.
44.5.
45.
45.1.
Description .................................................................................................................... 97
45.2.
Data Provider................................................................................................................. 97
45.3.
Parameters .................................................................................................................... 97
45.3.1.
45.3.2.
45.4.
45.5.
45.6.
46.
46.1.
46.2.
46.2.1.
46.2.2.
46.2.3.
46.3.
46.4.
46.5.
47.
47.1.
47.2.
47.2.1.
47.2.2.
47.3.
47.4.
47.5.
48.
48.1.
48.2.
48.2.1.
48.3.
48.4.
48.5.
15
3.
General
This document describes instructions provided by PLC Reports to be used to create reports.
Reports are created by sequential execution of instructions defined in the worksheet Instructions
of the corresponding report template. Depending on the instruction type, different parameters can
be passed to the command.
The following chapters give detailed descriptions of the functionality, the syntax as well as the
possible parameters of each instruction. Furthermore it describes errors and its possible sources.
16
4.
4.1.
Description
The instruction Archive Array Variable is used to archives values with fast acquisition cycles, e.g.
10ms. Because such values cannot be read reliably in real-time due to Ethernet limitations, often a
PLC memory buffer is used to store the values temporarily until they are read by the data acquisition
system. The instruction Archive Array Variable reads such buffer arrays of values from the PLC and
moves them into a data archive. The time stamp of the buffers first value is read by means of a
second variable. The timestamps of the following values are calculated on basis of an adjustable
cycle.
Note!
To display timestamps in the desired format, the destination Excel cells must be formatted correctly.
By default, Excel does not provide a format for displaying timestamps showing full details about both
date and time in the same cell. To get a fully-detailed display, a custom format needs to be used.
Right click the cell to format and select Format Cells Custom. Enter the desired format into the
field Type.
Example: mm/dd/yyyy h:mm:ss AM/PM will be displayed as 12/22/2007 2:20:04 PM
17
4.2.
Parameters
The command requires at least 4 parameters: The index of the variable to read, the name of the
archive to write the value into, the index of the timestamp variable and the cycle. The archiving
mode can be passed optionally.
4.2.1. Parameter 1: Index of the Variable to Read
Valid values are indexes of defined variables. This parameter is always required.
4.2.2. Parameter 2: Archive Name
Valid values are names of defined archives. This parameter is always required.
4.2.3. Parameter 3: Index of the Time Stamp Variable
Valid values are indexes of defined variables. This parameter is always required.
4.2.4. Parameter 4: Cycle
Valid values are timespans in milliseconds, seconds, minutes or hours:
- n Msec
- n Millisec
- 1 Millisecond
- n Milliseconds
- n Sec
- 1 Second
- n Seconds
- 1 Minute
- n Minutes
- 1 Hour
- n Hours
This parameter is always required.
4.2.5. Parameter 5: Mode
Several calculation functions can be performed on the fly while archiving. The parameter Mode
defines the archiving mode. If no mode is passed, the actual online value will be archived.
Valid values are:
- Min
- Max
- Average
- Increment
- Summation Second
- Summation Minute
- Summation Hour
4.2.5.1. Min
The mode Min calculates the minimum value within an archiving cycle. The archiving cycle is
defined in the column Cycle of the archive definition.
Example:
An archive has a cycle of 1 Hour, but every 10 seconds the value is written into the archive using
the mode Min. Therefore, the archive will contain one value per hour, namely the lowest of the
values archived within the hour.
18
4.2.5.2. Max
The mode Max calculates the maximum value within an archiving cycle. The archiving cycle is
defined in the column Cycle of the archive definition.
Example:
An archive has a cycle of 1 Hour, but every 10 seconds the value is written into the archive using
the mode Max. Therefore, the archive will contain one value per hour, namely the highest of the
values archived within the hour.
4.2.5.3. Average
The mode Average calculates the average value within an archiving cycle. The archiving cycle is
defined in the column Cycle of the archive definition.
Example:
An archive has a cycle of 1 Hour, but every 10 seconds the value is written into the archive using
the mode Average. Therefore, the archive will contain one value per hour, namely the average of
all the values archived within the hour.
4.2.5.4. Increment
The mode Increment calculates the increment of a counter value within an archiving cycle. The
archiving cycle is defined in column Cycle of the archive definition.
Example:
An archive has a cycle of 1 Hour. Once per hour the actual counter value is written into the archive
using the mode Increment. Therefore, the archive will contain one value per hour, namely the
increment of the counter within the hour.
4.2.5.5. Summation
If a counter value is to be logged but there is none, and only an online measurement value is
available, one of the modes Summation Second, Summation Minute or Summation Hour can
be used. The difference between the three modes is the time basis of the calculation.
Example:
A flow measurement sensor has a range of 0-100l/min and is connected to a PLC. Using the mode
Summation Minute a counter value will be calculated in liters out of the actual flow measurement
value with the time basis Minute.
Note!
The time basis of the summation second, minute or hour must match the measurement unit of
the sensor.
Note!
The precision of the summation calculation is normally lower compared to the precision of a
hardware counter. Factors influencing the precision are unsteady measurement values, tolerances of
the sensor and the PLC input card as well as the measurement cycle.
Nevertheless, summation of measurement values to gain counter values is cost effective and precise
enough for many applications.
19
4.3.
Sample Application
4.4.
4.5.
Possible Errors
Error Message
20
21
5.
5.1.
Description
The instruction Archive Batch Index reads a Batch ID from the PLC and checks if the value has
changed since the last time it was read. If the Batch ID has changed and is not equal to the specified
inactive value, a new batch record is created and written into the corresponding archive. If the actual
Batch ID is an empty string or equal to zero, no batch record is created.
The timestamps Batch Begin and Batch End can be created in two different ways:
1. The time and date when the Batch ID value change was recognized by PLC Reports
2. Timestamps read from the PLC using one variable for the Batch Begin timestamp and
optionally another variable for the Batch End timestamp.
5.2.
Parameters
The command requires at least 4 parameters: The index of the Batch ID variable to read, the name of
the archive to write the batch record into, the batch inactive constant and the timestamp mode.
Instead of the timestamp mode, a Batch Start Timestamp variable index and a Batch End
Timestamp variable index can be passed. If only a Batch Start Timestamp variable index is passed,
the batch record can be completed later using the instruction Archive Batch Index End.
5.2.1. Parameter 1: Index of the Batch ID Variable to Read
Valid values are indexes of defined variables. This parameter is always required.
5.2.2. Parameter 2: Archive Name
Valid values are names of defined archives. This parameter is always required.
5.2.3. Parameter 3: Batch Inactive Value
Valid are all values within the value range of the variables data type.
5.2.4. Parameter 4: Timestamp Mode or Index of the Batch Begin Timestamp Variable
Valid values are:
- Change Data
The time and date when the Batch ID value change was
recognized by PLC Reports is used.
- Now
The current report trigger timestamp is used.
- Index of a variable
The actual value of the specified variable is used. The variables data
type must be a type containing date and time.
5.2.5. Parameter 5: Index of the Batch End Timestamp Variable
- Valid values are indexes of defined variables. The variables data type must be a type
containing date and time. The parameter can be omitted to archive only the start time of the
Batch ID and finalize the record later.
22
5.3.
Sample Application
5.4.
5.5.
Possible Errors
Error Message
23
Error Message
Parameter Start: The value
'LastValueChangedDateTime' is not available.
Get value by 'GetChangeData' instruction first
24
6.
6.1.
Description
The instruction Archive Batch Index End reads a Batch ID from the PLC and searches for the
corresponding record within the specified batch index archive. If a record without an end timestamp
exists and the actual Batch ID is not an empty string and is not equal to zero, the record is completed
by writing the batch end timestamp into it.
The instruction Archive Batch Index End is used if only the Batch Begin data was archived by a
formerly executed Archive Batch Index instruction (Multi-Batch).
The timestamp Batch End can be created in two different ways:
1. The time and date when the Batch ID value change was recognized by PLC Reports
2. A timestamp read from the PLC using one variable for the Batch Begin timestamp and
optionally another variable for the Batch End timestamp.
6.2.
Parameters
The command requires 4 parameters: The index of the Batch ID variable to read, the name of the
archive to write the batch record into, the batch inactive constant and the timestamp mode. Instead
of the timestamp mode, a Batch End Timestamp variable index can be passed.
6.2.1. Parameter 1: Index of the Batch ID Variable to Read
Valid values are indexes of defined variables. This parameter is always required.
6.2.2. Parameter 2: Archive Name
Valid values are names of defined archives. This parameter is always required.
6.2.3. Parameter 3: Batch Inactive Value
Valid are all values within the value range of the variables data type.
6.2.4. Parameter 4: Timestamp Mode or Index of the Batch End Timestamp Variable
Valid values are:
- Change Data
The time and date when the Batch ID value change was
recognized by PLC Reports is used.
- Now
The current report trigger timestamp is used.
- Index of a variable
The actual value of the specified variable is used. The variables data
type must be a type containing date and time.
25
6.3.
Sample Application
6.4.
6.5.
Possible Errors
Error Message
26
Error Message
27
7.
Archive Variable
7.1.
Description
The instruction Archive Variable reads the variables actual online value from the PLC and writes it
into an archive. Different archiving modes are available.
7.2.
Parameters
The command requires at least 2 parameters: The index of the variable to read and the name of the
archive to write the value into. The archiving mode can be passes optionally.
7.2.1. Parameter 1: Index of the Variable to Read
Valid values are indexes of defined variables. This parameter is always required.
7.2.2. Parameter 2: Archive Name
Valid values are names of defined archives. This parameter is always required.
7.2.3. Parameter 3: Mode
Several calculation functions can be performed on the fly while archiving. The parameter Mode
defines the archiving mode. If no mode is passed, the actual online value will be archived.
Valid values are:
- Min
- Max
- Average
- Increment
- Summation Second
- Summation Minute
- Summation Hour
- OEE Time
- OEE %Time
7.2.3.1. Min
The mode Min calculates the minimum value within an archiving cycle. The archiving cycle is
defined in the column Cycle of the archive definition.
Example:
An archive has a cycle of 1 Hour, but every 10 seconds the value is written into the archive using
the mode Min. Therefore, the archive will contain one value per hour, namely the lowest of the
values archived within the hour.
7.2.3.2. Max
The mode Max calculates the maximum value within an archiving cycle. The archiving cycle is
defined in the column Cycle of the archive definition.
Example:
An archive has a cycle of 1 Hour, but every 10 seconds the value is written into the archive using
the mode Max. Therefore, the archive will contain one value per hour, namely the highest of the
values archived within the hour.
28
7.2.3.3. Average
The mode Average calculates the average value within an archiving cycle. The archiving cycle is
defined in the column Cycle of the archive definition.
Example:
An archive has a cycle of 1 Hour, but every 10 seconds the value is written into the archive using
the mode Average. Therefore, the archive will contain one value per hour, namely the average of
all the values archived within the hour.
7.2.3.4. Increment
The mode Increment calculates the increment of a counter value within an archiving cycle. The
archiving cycle is defined in column Cycle of the archive definition.
Example:
An archive has a cycle of 1 Hour. Once per hour the actual counter value is written into the archive
using the mode Increment. Therefore, the archive will contain one value per hour, namely the
increment of the counter within the hour.
7.2.3.5. Summation
If a counter value is to be logged but there is none, and only an online measurement value is
available, one of the modes Summation Second, Summation Minute or Summation Hour can
be used. The difference between the three modes is the time basis of the calculation.
Example:
A flow measurement sensor has a range of 0-100l/min and is connected to a PLC. Using the mode
Summation Minute a counter value will be calculated in liters out of the actual flow measurement
value with the time basis Minute.
Note!
The time basis of the summation second, minute or hour must match the measurement unit of
the sensor.
Note!
The precision of the summation calculation is normally lower compared to the precision of a
hardware counter. Factors influencing the precision are unsteady measurement values, tolerances of
the sensor and the PLC input card as well as the measurement cycle.
Nevertheless, summation of measurement values to gain counter values is cost effective and precise
enough for many applications.
29
7.3.
Sample Application
7.4.
30
7.5.
Possible Errors
Error Message
31
8.
8.1.
Description
The command Check Negative Edge checks if a Boolean archive value has changed its state from
True to False. The value of the last archive cycle is being compared with the value of the current
cycle.
The logical result of the command can be used in subsequent instructions, e.g. to perform a
conditional jump using the Go To if Yes command.
PLC Reports provides a logical result bit for each instruction list. Check-instructions write their
results into the logical result bit. Conditional commands, especially the Go To if Yes/No commands,
evaluate this result.
8.2.
Parameters
The command requires one parameter: The name of the archive to be checked.
8.2.1. Parameter 1: Archive Name
Valid values are the names of archives defined in the report file. This parameter is always required.
8.3.
Sample Application
8.4.
8.5.
Possible Errors
Error Message
32
9.
9.1.
Description
The command Check New Period checks if a new time period has begun. The time period to check
is specified in the parameter and is checked against the scheduled start time. The result of the test is
being written into the logical result bit of the current instruction list and can be used subsequently
for conditional jumps.
Note!
This command is designed for special tasks only. The use of scheduling triggers is recommended
whenever possible.
9.2.
Parameters
9.3.
Sample Application
9.4.
9.5.
Possible Errors
Error Message
33
10.
10.1. Description
The command Check Positive Edge checks if a Boolean archive value has changed its state from
False to True. The value of the last archive cycle is being compared with the value of the current
cycle.
The logical result of the command can be used in subsequent instructions, e.g. to perform a
conditional jump using the Go To if Yes command.
PLC Reports provides a logical result bit for each instruction list. Check-instructions write their
results into the logical result bit. Conditional commands, especially the Go To if Yes/No commands,
evaluate this result.
10.2. Parameters
The command requires one parameter: The name of the archive to be checked.
10.2.1. Parameter 1: Archive Name
Valid values are the names of archives defined in the report file. This parameter is always required.
34
11.
11.1. Description
The command Check Value Change checks if an archive value has changed since the last archive
cycle. The test result is written into the logical result bit of the current instruction list and can be
used in subsequent instructions, e.g. to perform a conditional jump using the Go To if Yes
command.
PLC Reports provides a logical result bit for each instruction list. Check-instructions write their
results into the logical result bit. Conditional commands, especially the Go To if Yes/No commands,
evaluate this result.
11.2. Parameters
The command requires one parameter: The name of the archive to be checked.
11.2.1. Parameter 1: Archive Name
Valid values are the names of archives defined in the report file. This parameter is always required.
35
12.
12.1. Description
The command Check Variable Value Change checks if a variable value has changed. The command
compares the last changed value with the actual online one. The test result is written into the logical
result bit of the current instruction list and can be used in subsequent instructions, e.g. to perform a
conditional jump using the Go To if Yes command.
PLC Reports provides a logical result bit for each instruction list. Check-instructions write their
results into the logical result bit. Conditional commands, especially the Go To if Yes/No commands,
evaluate this result.
12.2. Parameters
The command requires at least two parameters: The index of the variable to be checked and the
dead band. Optionally, an inactive value and a flag, indicating if the value following an inactive value
is counted as change, can be passed.
12.2.1. Parameter 1: Variable Index
Valid values are the indices of variables defined in the report file. This parameter is always required.
12.2.2. Parameter 2: Dead Band
Valid values are the indices of variables defined in the report file. This parameter is always required.
12.2.3. Parameter 3: Inactive Value
This optional parameter defines a value indicating an inactive state.
12.2.4. Parameter 4: Value Following an Inactive Value is a Change (Yes/No)
This optional parameter defines if the value following an inactive value is interpreted as a change.
Valid values are
- Yes
- No
- True
- False
36
37
13.
13.1. Description
The command Check Working Copy checks if a working copy is available and if it is up-to-date. The
parameter passed defines how old a working copy may be at maximum.
In addition to the use of archives it is possible to write data directly into a report file. In this case, at
each scheduling event the report file is being opened, the data is added and the report file is saved.
At the end of a reporting period the report is finalized and moved into the final output directory. A
working copy is always used to create reports. The advantage is that reports are available at any
time, even in the middle of a reporting period. Example: One monthly value is added every month to
an annual report.
Note!
For storing historical values using archives is recommended whenever possible. Nevertheless, in
some special cases it might be necessary to work directly with the Excel report files.
Note!
For logging values directly into a report file, without the use of archives, only cycles >=1 minute are
supported.
13.2. Parameters
The command requires one parameter: The maximum age of the report file.
13.2.1. Parameter 1: Maximum Age
Valid values are:
1 Second
Not older than 1 Second
100 Seconds
Not older than 100 Seconds
1 Minute
100 Minutes
This Minute
Previous Minute
1 Hour
100 Hours
This Hour
Previous Hour
1 Day
100 Days
This Day
Previous Day
1 Week
100 Weeks
This Week
Previous Week
1 Month
100 Months
This Month
Previous Month
1 Year
100 Years
This Year
Previous Year
39
14.
Clean Report
14.1. Description
The command Clean Reports deletes the worksheets Settings, Variable, Archives,
Instructions and Scheduling from the actual report file.
Note!
The command can only be executed if the report file is opened.
14.2. Parameters
None
40
41
15.
15.1. Description
After a report was opened and filled with data the working copy of the report needs to be closed.
The command Close Report File closes the actual working copy of the report. This command is
mainly used if the data is written repeatedly into the same report file without the use of archives.
Note!
If a report is finally saved using the command Save Final Report File, explicit closing of the report
file is not necessary because this task is already performed by the command Save Final Report File.
15.2. Parameters
None
42
16.
16.1. Description
The command Compare Two Variables compares the values of two variables. Different comparing
operands can be used.
The logical result of the command can be used in subsequent instructions, e.g. to perform a
conditional jump using the Go To if Yes command.
PLC Reports provides a logical result bit for each instruction list. Check-instructions write their
results into the logical result bit. Conditional commands, especially the Go To if Yes/No commands,
evaluate this result.
16.2. Parameters
The command always requires one parameter: The comparison expression.
16.2.1. Parameter 1: Comparison Expression
Structure of the comparison expression:
Variable-Index-1 Operand Variable-Index-2
Example:
10 >= 11 (Compare the value of the variable with index 10* with value of the variable with index 11*)
* A variable with the specified index must be defined.
Valid operands are:
- <=
Compare if less or equal
- >=
Compare if greater or equal
- !=
Compare if not equal
- =
Compare if equal
- <
Compare if less
- >
Compare if greater
43
Syntax error
44
17.
Compare Variable
17.1. Description
The command Compare Variable compares the value of the variable with a constant. Different
comparing operands can be used.
The logical result of the command can be used in subsequent instructions, e.g. to perform a
conditional jump using the Go To if Yes command.
PLC Reports provides a logical result bit for each instruction list. Check-instructions write their
results into the logical result bit. Conditional commands, especially the Go To if Yes/No commands,
evaluate this result.
17.2. Parameters
The command always requires one parameter: The comparison expression.
17.2.1. Parameter 1: Comparison Expression
Structure of the comparison expression:
Variable-Index Operand Constant
Example:
10 >= 1,000 (Compare the value of the variable with index 10* with the constant 1,000)
* A variable with the specified index must be defined.
Valid operands are:
- <=
Compare if less or equal
- >=
Compare if greater or equal
- !=
Compare if not equal
- =
Compare if equal
- <
Compare if less
- >
Compare if greater
45
Syntax error
46
18.
Copy Variable
18.1. Description
The command Copy Variable copies the actual value of one variable into another variable.
18.2. Parameters
The command always requires two parameters: The index of the source and the index of the
destination variable.
18.2.1. Parameter 1: Source Variable Index
Valid values are the indices of variables defined in the report file. This parameter is always required.
18.2.2. Parameter 2: Destination Variable Index
Valid values are the indices of variables defined in the report file. This parameter is always required.
47
19.
19.1. Description
The command Create New Report File creates a new copy of the report definition file and saves it
in the base output directory (Output directory without subfolders for days, weeks, month or years).
The name of the working copy is set to the original filename of the report template plus the
extension Working.
If another working copy exists in the output directory, it will be moved into the final output directory
and the extension Working will be replaced by Cancelled.
19.1.1. Output Directory
The setting Output Directory, defined in the report settings, specifies the directory to be used for
report creation and serves as the working directory at the same time. In addition, it is possible to
define whether or not subfolders for days, weeks, months or years should be created.
19.1.2. Final Output Directory
The final output directory depends on the above mentioned setting.
Example: Supposing that the output directory is set to D:\Reports and subfolders for years, months
and days are being used, on July 22, 2010 the final directory would be D:\Reports\2010\07\22.
Note!
Use local drives only!
If network drives are used, the performance of PLC Reports will be unpredictable. Time critical tasks
like logging variables can be unexpectedly delayed. Queuing of events caused by bad or not-at-all
reachable network locations might cause critical errors and can also lead to the loss of the data.
19.2. Parameters
None
48
49
20.
20.1. Description
PLC Reports doesnt allow the same scheduling event to start again before an earlier event has
finished execution. This is important to prevent queuing of events or even processor overloads for
instance while installing windows updates or while starting resource consuming applications.
In case trigger events are queued, a warning message is created.
Nevertheless, in some applications it might be necessary to disable specific warning messages.
The command Disable Trigger Warning disables all trigger warnings of the currently executed
instruction list until the execution has ended.
20.2. Parameters
None
50
21.
21.1. Description
The command Delete Report File closes and deletes the working copy of the report and is used if
the final report is required in PDF format only. After creating a PDF report (Instruction Save Report
as PDF) the Excel working copy of the report can be deleted if no Excel version of the report is
needed.
Note!
Virus scanners might delay the command for several seconds.
21.2. Parameters
None
51
22.
Exit
22.1. Description
The command Exit stops the execution of the current instruction list. Make sure that the report file
was saved and closed properly before calling the Exit instruction.
The command Exit can be called either at the end of an instruction list or at any other position. By
using the commands Go To If Yes or Go To If No the Exit command can be skipped or called
conditionally.
22.2. Parameters
None
52
23.
23.1. Description
The instruction Get Change Data reads information about the last and the last but one value
change from an archive. The following data is read from the archive and provided for the subsequent
instructions:
- Last value
- Timestamp of the last value change
- Last but one value
- Timestamp of the last but one value change
23.2. Parameters
The command always requires one parameter: The name of the archive.
23.2.1. Parameter 1: Archive Name
Valid values are the archive names defined in the report. This parameter is always required.
53
54
24.
Go To
24.1. Description
The command Go To jumps to the instruction with the specified index.
24.2. Parameters
The command requires one parameter: The index of the instruction to jump to.
24.2.1. Parameter 1: Instruction Index
Parameter 1 specifies the index of the instruction to jump to.
Valid values are indexes of instructions defined in the report template. This parameter is always
required.
55
25.
Go To If No
25.1. Description
The command Go To If No is used in combination with a comparison instruction, e.g. Compare
Variable. It checks the logical result bit of the actual instruction list which was set by a formerly
executed command.
If the state of the logical result bit is False, the command jumps to the instruction with the
specified index.
If the state of the logical result bit is True, the command is ended without taking any action.
25.2. Parameters
The command requires one parameter: The index of the instruction to jump to.
25.2.1. Parameter 1: Instruction Index
Parameter 1 specifies the index of the instruction to jump to.
Valid values are indexes of instructions defined in the report template. This parameter is always
required.
56
26.
Go To If Yes
26.1. Description
The command Go To If Yes is used in combination with a comparison instruction, e.g. Compare
Variable. It checks the logical result bit of the actual instruction list which was set by a formerly
executed command.
If the state of the logical result bit is True, the command jumps to the instruction with the specified
index.
If the state of the logical result bit is False, the command is ended without taking any action.
26.2. Parameters
The command requires one parameter: The index of the instruction to jump to.
26.2.1. Parameter 1: Instruction Index
Parameter 1 specifies the index of the instruction to jump to.
Valid values are indexes of instructions defined in the report template. This parameter is always
required.
57
27.
27.1. Description
The command Open Report File opens the working copy of the report. The working copy needs to
be opened before values can be written into the report. The following preparations must be done
before writing data into a report file:
- Create a new report working copy (Instruction Create New Report File).
- Open the working copy using this instruction.
27.2. Parameters
None
58
28.
Print Report
28.1. Description
The command Print Report prints the report on an installed printer. The name of the printer can be
specified by a parameter. If the name of the printer cannot be found, the report will be printed on
the default printer defined in the report file (Excel printer settings). In addition, the name of the
worksheet to be printed can be specified. If no worksheet is specified, the whole workbook will be
printed.
Note!
The command can only be executed if the report file is opened.
Note!
Make sure that in the report definition file the print area of each worksheet to be printed is set
correctly. Consider cleaning the report using the command Clean Report before printing.
28.2. Parameters
The command requires two parameters: The name of the worksheet to be printed and the name of
the printer.
28.2.1. Parameter 1: Worksheet
Parameter 1 defines the name of the worksheet to be printed. This parameter is always required.
Valid values are worksheet names existing in the report file or the placeholder symbol *.
Report
The name of the worksheet to be printed.
In this example, the worksheet Report is being printed.
*
If the placeholder symbol * is passed in parameter 1, the complete workbook will be
printed.
28.2.2. Parameter 2: Printer Name
Parameter 2 defines the name of the printer to be used. This parameter is always required.
Valid values are installed printers or the placeholder symbol *.
My Printer
The name of the printer to be used.
In this example, the report will be printed on the printer My Printer.
*
If the placeholder symbol * is being passed in parameter 2, the report will be printed
on the default printer selected in the printer settings of the report file.
59
60
29.
Publish Range
29.1. Description
The command Publish Range exports a specified Excel worksheet area (Excel Range) as image file.
The image can subsequently be used to be displayed e.g. in a SCADA system using a web browser.
Note!
The command can only be executed if the report file is opened.
Note!
The command uses the windows clipboard. Note that clipboard content of other applications will be
overwritten when executing the command.
29.2. Parameters
The instruction requires 4 parameters: The name of the worksheet, the start cell, the end cell and the
destination path and filename.
29.2.1. Parameter 1: Worksheet Name
Parameter 1 specifies the name of the worksheet. Valid values are existing worksheet names. This
parameter is always required.
29.2.2. Parameter 2: Start Cell
Valid values are cell identifiers, e.g. A1. The instruction exports the area between the start and the
end cell.
29.2.3. Parameter 3: End Cell
Valid values are cell identifiers, e.g. J33. The instruction exports the area between the start and the
end cell.
29.2.4. Parameter 4: Path and Filename
Parameter 4 specifies the destination path and filename. The parameter must be specified according
to Windows path and file name rules. The extension name is always .png.
61
62
30.
30.1. Description
The command Read Archived Variable reads values of a specified time range from an archive and
writes them into the defined Excel cells.
Note!
The command can only be executed if the report file is opened.
30.2. Parameters
The instruction requires up to 4 parameters: The name of the archive to read data from, the
beginning and ending of the time range and a flag indicating if a new row should be inserted into the
Excel sheet for each value.
30.2.1. Parameter 1: Archive Name
Parameter 1 specifies the name of the archive to read data from. This parameter is always required.
Valid values are names of archives defined in the report template.
30.2.2. Parameter 2: Start Time or Special Time Range
Parameter 2 can either specify the start time of the time range or a special time range, e.g. This
Day. This parameter is always required.
Valid values are:
- 12/22/2007 2:20:04PM Beginning of the time range
- Last But One Change Values from the last but one change of the archive value*
- Last Change
Values from the last change of the archive value*
- Time Range
Values from a time range defined by the user**
- x Seconds
Values of the last x seconds before starting the command
- x Minutes
Values of the last x minutes before starting the command
- This Minute
Values of this minute
- Previous Minute
Values of the previous minute
- x Hours
Values of the last x hours before starting the command
- This Hour
Values of this hour
- Previous Hour
Values of the previous hour
- x Days
Values of the last x days before starting the command
- This Day
Values of this day
- Previous Day
Values of the previous day
- x Weeks
Values of the last x weeks before starting the command
- This Week
Values of this week
- Previous Week
Values of the previous week
- x Months
Values of the last x months before starting the command
- This Month
Values of this month
- Previous Month
Values of the previous month
- x Years
Values of the last x years before starting the command
- This Year
Values of this year
- Previous Year
Values of the previous year
* To use the special time ranges Last But One Change and Last Change the instruction Get
Change Data must be called before.
** To use a time range selected by the user the instruction User Input must be first called.
63
64
Invalid Parameters
No Archive named xxx defined
Parameter 2 (From): The parameter cannot be
converted into a valid timespan
Parameter From: The value
'LastButOneValueChangedDateTime' is not
available. Get value by 'GetChangeData'
instruction first
Parameter Until: The value
'LastValueChangedDateTime' is not available.
Get value by 'GetChangeData' instruction first
Parameter From is later than Parameter Until
Error opening the archive
Reading data from the selected time period
results in more than xxx values
65
31.
31.1. Description
The instruction Read Batch Index Data reads the begin and the end timestamp from a batch index
archive and provides the data for use in following instructions.
31.2. Parameters
The command requires 3 parameters: The name of the batch index archive, the ID of a variable
containing the Batch ID to search for and a flag indicating if an error message is created if the desired
batch ID was not found in the archive.
31.2.1. Parameter 1: Archive Name
Parameter 1 specifies the name of the batch index archive to read data from. This parameter is
always required. Valid values are names of archives defined in the report template.
31.2.2. Parameter 2: Index of a Variable Containing the Requested Batch ID
This parameter is always required. Valid values are:
- Index of a variable
The index of a variable containing the Batch ID to search for
- User Input
Use of the previously entered Batch ID
(Entered by means of the command User Input)
31.2.3. Parameter 3: Error Message if the Batch ID Was Not Found in the Archive
Valid values are:
- Yes
If the Batch ID was not found in the archive, an error message is
created
- No
No error message is created if the Batch ID was not found in the
Archive
67
32.
32.1. Description
The same as the command Read Variable, the command Read Indexed Variable reads the online
value of a variable from the PLC and writes it into the cell specified in the variable definition. The
difference to the command Read Variable is that the index of the variable to read is not fixed, but
defined by the value of another variable, the so-called index variable.
Example:
Read Indexed Variable (10)
This command interprets the value of variable 10 as an index - e.g. 17 - and then reads the online
value of the variable with index 17 from the PLC and writes its value to the report.
In contrast to the use of archives, the command Read Indexed Variable writes the variable value
directly to the specified report cell. If specified in the variable definition, the time stamp can also be
written to a report cell.
Note!
The command can only be executed if the report file is opened.
32.2. Parameters
The command requires one parameter: The index of the variable defining the variable to read (Index
variable).
32.2.1. Parameter 1: Index of the Index Variable
This parameter specifies the index of the variable whose value is to be interpreted as an index of the
variable to be read. This parameter is always required.
Valid values are indexes of defined variables.
68
69
33.
33.1. Description
The command Read SQL Access sends a SQL query to Microsoft Access and transfers the result data
into PLC Reports variables and optionally directly into a report.
In order to query data dynamically, it is possible to insert placeholder values like time stamps or any
other variable values into the SQL query.
First, the actual values of the specified placeholder variables are determined and inserted into the
SQL query, then a connection to the database is established and the SQL query is sent to the
database and the results are received and transferred into the specified variables and report cells.
Finally, the connection to the database is being closed.
Note!
SQL queries are interpreted at runtime by the database engine. Therefore PLC Reports only
performs a basic syntax validation. If an error occurs while executing the query, the message
received from the database engine along with the completed SQL query including the current
placeholder variable values are recorded in the PLC Reports message list.
70
33.3. Parameters
The command always requires 5 parameters: The variable range in which the SQL query results are
written into, the columns of the database table to read data from, the definition whether or not PLC
Reports shall automatically insert rows into the report, the connection string and the SQL query.
33.3.1. Parameter 1: Variable Range
Parameter 1 specifies the variable range in which the SQL query result data will be written. The
variable range needs to be subsequent. The sequence of the columns, defined in parameter 2 also
defines the sequence in which the resulting values are written into the variable range.
Example:
Parameter 1 specifies the variable range 1-3, parameter 2 defines the database table columns
Value1; Value2; Value3. In this case, the values of column Value1 will be written into variable 1, the
values of column Value2 will be written into variable 2 and the values of column Value3 will be
written into variable 3.
Note!
The data types of the database columns must be compatible with the data types of the variables.
33.3.2. Parameter 2: Columns of the database table
Parameter 2 defines the columns of the database table to read data from. The resulting data is
written into the actual value of the corresponding variable.
The columns are defined using semicolons as separators.
33.3.3. Parameter 3: Insert Rows
Valid values are:
- Insert Rows
For each result data row, one row is inserted into the Excel report.
- No
The result data is written into excel without inserting rows.
33.3.4. Parameter 4: Connection String
Parameter 4 specifies the database connection string. Make sure that the syntax matches the Access
connection string syntax. Further information about connection strings can be found in the Microsoft
Access documentation.
Note!
Connection strings might contain commas but PLC Reports as well uses commas as parameter
separators. Therefore, connection strings must be enclosed by quotes.
71
72
Invalid Parameters
There is no variable with index: xxx defined
Error reading the value from the PLC
73
74
34.
34.1. Description
The command Read SQL CSV reads data from a csv file using a SQL Odbc data provider and
transfers the result data into PLC Reports variables and optionally directly into a report.
In order to query data dynamically, it is possible to insert placeholder values like time stamps or any
other variable values into the SQL query.
First, the actual values of the specified placeholder variables are determined and inserted into the
SQL query, then the query is sent to the data provider and the results are received and transferred
into the specified variables and report cells. Finally, the connection to the data provider is being
closed.
Note!
SQL queries are interpreted at runtime by the data provide. Therefore PLC Reports only performs a
basic syntax validation. If an error occurs while executing the query, the message received from the
data provider along with the completed SQL query including the current placeholder variable values
are recorded in the PLC Reports message list.
75
34.4. Parameters
The command always requires 5 parameters: The variable range in which the SQL query results are
written into, the columns of the csv file to read data from, the definition whether or not PLC
Reports shall automatically insert rows into the report, the connection string and the SQL query.
34.4.1. Parameter 1: Variable Range
Parameter 1 specifies the variable range in which the SQL query result data will be written. The
variable range needs to be subsequent. The sequence of the columns, defined in parameter 2 also
defines the sequence in which the resulting values are written into the variable range.
Example:
Parameter 1 specifies the variable range 1-3, parameter 2 defines the columns Value1; Value2;
Value3. In this case, the values of column Value1 will be written into variable 1, the values of
column Value2 will be written into variable 2 and the values of column Value3 will be written
into variable 3.
Note!
The data types of the csv file columns must be compatible with the data types of the variables (see
Schema.ini file)
34.4.2. Parameter 2: Columns of the database table
Parameter 2 defines the columns of the csv file to read data from. The resulting data is written into
the actual value of the corresponding variable.
The columns are defined using semicolons as separators.
34.4.3. Parameter 3: Insert Rows
Valid values are:
- Insert Rows
For each result data row, one row is inserted into the Excel report.
- No
The result data is written into excel without inserting rows.
34.4.4. Parameter 4: Connection String
Parameter 4 specifies the database connection string. Make sure that the syntax matches the
connection string syntax of the data provider. Further information about connection strings can be
found in the Microsoft Microsoft Text Driver (*.txt; *.csv) documentation.
Note!
Connection strings might contain commas but PLC Reports as well uses commas as parameter
separators. Therefore, connection strings must be enclosed by quotes.
76
77
Invalid Parameters
There is no variable with index: xxx defined
Error reading the value from the PLC
78
35.
35.1. Description
The command Read SQL Server sends a SQL query to the specified SQL Server and transfers the
result data into PLC Reports variables and optionally directly into a report.
In order to query data dynamically, it is possible to insert placeholder values like time stamps or any
other variable values into the SQL query.
First, the actual values of the specified placeholder variables are determined and inserted into the
SQL query, then a connection to the database is established and the SQL query is sent to the
database server and the results are received and transferred into the specified variables and report
cells. Finally, the connection to the database server is being closed.
Note!
SQL queries are interpreted at runtime by the database engine. Therefore PLC Reports only
performs a basic syntax validation. If an error occurs while executing the query, the message
received from the database engine along with the completed SQL query including the current
placeholder variable values are recorded in the PLC Reports message list.
35.2. Parameters
The command always requires 5 parameters: The variable range in which the SQL query results are
written into, the columns of the database table to read data from, the definition whether or not PLC
Reports shall automatically insert rows into the report, the connection string and the SQL query.
35.2.1. Parameter 1: Variable Range
Parameter 1 specifies the variable range in which the SQL query result data will be written. The
variable range needs to be subsequent. The sequence of the columns, defined in parameter 2 also
defines the sequence in which the resulting values are written into the variable range.
Example:
Parameter 1 specifies the variable range 1-3, parameter 2 defines the database table columns
Value1; Value2; Value3. In this case, the values of column Value1 will be written into variable 1, the
values of column Value2 will be written into variable 2 and the values of column Value3 will be
written into variable 3.
Note!
The data types of the database columns must be compatible with the data types of the variables.
35.2.2. Parameter 2: Columns of the database table
Parameter 2 defines the columns of the database table to read data from. The resulting data is
written into the actual value of the corresponding variable.
The columns are defined using semicolons as separators.
79
80
81
Invalid Parameters
There is no variable with index: xxx defined
Error reading the value from the PLC
82
36.
Read Variable
36.1. Description
The command Read Variable reads the online value of a variable from the PLC and writes it into the
cell specified in the variable definition. In contrast to the use of archives, the command Read
Indexed Variable writes the variable value directly to the specified report cell. If specified in the
variable definition, the time stamp can also be written to a report cell.
If the variable definition does not define a report sheet and cell, the value is being read from the PLC
without writing it into a report cell. After executing the instruction, the value of the variable is
available for use in the following instructions.
36.2. Parameters
The command requires two parameter: The index of the variable to be read and optionally a flag
indicating if a new row should be inserted into the Excel sheet for each value.
36.2.1. Parameter 1: Index of the Variable
This parameter specifies the index of the variable to be read. This parameter is always required.
Valid values are indexes of defined variables.
36.2.2. Parameter 2: Insert Rows
Parameter 2 can optionally be used to specify the insertion of rows for each value written into the
Excel sheet.
Valid values are:
- Insert Rows
Optional parameter: For each value a row will be inserted into Excel
83
84
37.
37.1. Description
The command Read Variable from Cell reads the value from the Excel cell defined in the variable
definition and uses it as the online value of the variable. The command can be used to perform Excel
formula or macro based calculations and then to write the result back into a variable. The timestamp
of the variable will be set to the reading time of the value from the cell.
Note!
The command can only be executed if the report file is opened.
37.2. Parameters
The command requires one parameter: The index of the variable to be read.
37.2.1. Parameter 1: Index of the Variable
This parameter specifies the index of the variable to be read from the Excel cell. This parameter is
always required.
Valid values are indexes of defined variables.
85
38.
38.1. Description
The command Read Variable Range reads the online value of multiple variables from the PLC and
writes them into the cells specified in the variable definitions. In contrast to the use of archives, the
command Read Variable Range writes the variable values directly to the specified report cells. If
specified in the variable definitions, the time stamps can also be written to the report cells.
If the variable definition does not define a report sheet and cell, the value is being read from the PLC
without writing it into a report cell. After executing the instruction, the value of the variable is
available for use in the following instructions.
38.2. Parameters
The command requires one parameter: The index range of the variables to be read.
38.2.1. Parameter 1: Index Range
This parameter specifies the index range of the variables to be read. This parameter is always
required.
Valid values are indexes of defined variables. The index range is specified in the following format:
Start index - end index
Example: 1-10
86
39.
Run Macro
39.1. Description
The command Run Macro calls an Excel macro defined in the report file.
Note!
The command can only be executed if the report file is opened.
Note!
To run macros correctly without showing the Excel inquiry dialogs, the following points must be
considered when saving the report template:
- The report template must be saved in the .xlsm file format.
- The report file must be saved in an Excel trusted location.
- The report template must be saved without the option to Remove personal information
from file properties on save:
39.2. Parameters
The command requires one parameter: The name of the macro to be called.
39.2.1. Parameter 1: Macro Name
Parameter 1 specifies the name of the macro to be called. Valid values are names of macros defined
in the report template file.
88
40.
40.1. Description
The command Save Final Report File saves and closes the current working copy of the report,
creates the final filename and moves it to the final output directory. Depending on the report
settings, subfolders for years, months, weeks or days are created. The final report filename is the
combination of the template name and the actual date and time in format JJJJ-MM-TT SS.MM.SS.
This format is used independently of the regional settings to make sure that the reports are ordered
by date, if shown in the Windows Explorer. As time separator, instead of :, . is used because the
use of : is not allowed in Windows filenames.
40.2. Parameters
Optionally, a user defined filename can be used
40.2.1. Parameter 1: User Defined File Name
Parameter 1 optionally specifies the format of the report file name. Strings as well as variable values
can be used. The slash character / is used as separator.
String
Any string, enclosed by quotation marks.
30
The index of a variable. The value of the variable is used in the file name.
89
90
41.
41.1. Description
The command Save Report as PDF saves the actual working copy of the report as PDF into the final
output directory. The worksheet to be saved as PDF can be specified in the parameters. If no
worksheet is specified, the complete workbook is saved as PDF.
Depending on the report settings, subfolders for years, months, weeks or days are created. The final
report filename is the combination of the template name and the actual date and time in format JJJJMM-TT SS.MM.SS. This format is used independently of the regional settings to make sure that the
reports are ordered by date, if shown in the Windows Explorer. As time separator, instead of :, .
is used because the use of : is not allowed in Windows filenames.
Note!
The command Save Report as PDF is supported in Excel 2007 or newer. If Excel 2003 is being used,
PDF files can only be created using a PDF printer in combination with the command Print Report.
41.2. Parameters
The command requires one parameter: The definition of the worksheet to be saved as PDF.
Optionally, a user defined filename can be used
41.2.1. Parameter 1: Worksheet
Report
The name of the worksheet to be saved as PDF.
In this example, the worksheet Report is saved as PDF.
*
If the placeholder * is used, the complete workbook is being saved as PDF.
41.2.2. Parameter 2: User Defined File Name
Parameter 1 optionally specifies the format of the report file name. Strings as well as variable values
can be used. The slash character / is used as separator.
String
Any string, enclosed by quotation marks.
30
The index of a variable. The value of the variable is used in the file name.
91
92
42.
42.1. Description
The command Save Report File saves the changes of the actual working copy of the report. The
command does not move the file to the final output directory, so that it can be reopened at any time
to add further data. If the report must be saved and moved to the final destination, use the
instruction Save Final Report File instead.
42.2. Parameters
None
93
43.
43.1. Description
The command Send Report As Email sends the last saved report file as email to the specified
recipient(s). If the reports was saved before as PDF, the PDF file will be sent, whereas if the report
was saved as Excel, the Excel file will be sent.
To send a report in both formats (PDF and Excel), please proceed as following:
1. Save the report as PDF using the command Save Report As PDF
2. Send the PDF report using the command Send Report As Email
3. Save the report as Excel version using the command Save Final Report File
4. Send the Excel version of the report using the command Send Report As Email
Note!
The command Save Report as PDF is supported in Excel 2007 or newer. If Excel 2003 is being used,
PDF files can only be created using a PDF printer in combination with the command Print Report.
43.2. Parameters
The command requires ten parameters:
43.2.1. Parameter 1: Sender Email Account
Parameter 1 specifies the email account to be used to send the report.
43.2.2. Parameter 2: From
Parameter 2 specifies the sender name. The recipient will see the sender name in the From field.
43.2.3. Parameter 3: Recipient Email Address
Parameter 3 specifies the recipients email address. If the report is sent to multiple recipients, the
email addresses must be specified separated by semicolon.
43.2.4. Parameter 4: Subject
Parameter 4 specifies the subject of the email.
43.2.5. Parameter 5: Message Text
Parameter 5 can be used to define a message text. Note that the message text must not contain
commas since the commas is used as parameter separator.
43.2.6. Parameter 6: Mail Server
Parameter 6 specifies the name of the mail server used to send the email.
43.2.7. Parameter 7: Port
Parameter 7 specifies the mail server port.
43.2.8. Parameter 8: Password
Parameter 8 specifies the mail server password.
43.2.9. Parameter 9: SSL
Parameter 9 specifies whether or not the email is send with SSL encryption.
Valid values are:
- SSL
- No
94
43.2.10.
Parameter 10: Timeout
Parameter 10 specifies the send timeout. Depending on the size of the report and the internet
connection speed, sending the report can take between several seconds up to multiple minutes.
The timeout is specified in milliseconds.
95
44.
User Input
44.1. Description
The instruction User Input is designed to let the user manually select a time range when starting a
report manually. It can be called at the start of a manual report for selecting the desired report time
range.
44.2. Parameters
The command requires one parameter which selects the type of the user input Time Range or
BatchID.
44.2.1. Parameter 1: Time Range or Batch ID
This parameter prompts the user to select a time range or a Batch ID. This parameter is always
required.
Valid values are:
- Time Range
- Batch ID
96
45.
45.1. Description
The command Write SQL Access writes the actual values of the specified variables into a Microsoft
Access database.
First, the actual values of the specified placeholder variables are determined and inserted into the
SQL query, then a connection to the database is established and the SQL command is sent to the
database. Finally, the connection to the database is being closed.
Note!
SQL queries are interpreted at runtime by the database engine. Therefore PLC Reports only
performs a basic syntax validation. If an error occurs while executing the command, the message
received from the database engine along with the completed SQL command including the current
placeholder variable values are recorded in the PLC Reports message list.
Note!
Since Access databases are file based, accessing the same database from multiple reports at the
same time may lead to access violations. Consider using a SQL Server database instead if access from
multiple reports is needed.
45.3. Parameters
The command always requires 2 parameters: The connection string and the SQL command.
45.3.1. Parameter 1: Connection String
Parameter 1 specifies the database connection string. Make sure that the syntax matches the SQL
Access connection string syntax. Further information about connection strings can be found in the
Microsoft Access documentation.
Note!
Connection strings might contain commas but PLC Reports as well uses commas as parameter
separators. Therefore, connection strings must be enclosed by quotes.
97
98
Invalid Parameters
There is no variable with index: xxx defined
Error reading the value from the PLC
99
46.
Write CSV
46.1. Description
The command Write CSV writes the actual values of the specified variables into CSV file.
First, the actual values of the specified placeholder variables are determined, then one row
containing the variables values is being added to the CSV file.
Note!
If the same CSV file is accessed by multiple reports at the same time, access violations can occur.
Consider using a SQL Server database instead if access from multiple reports is needed.
46.2. Parameters
The command always requires 3 parameters: The name and the path of the CSV file, the column
separator and a list of values to be written.
46.2.1. Parameter 1: Name and Path of the CSV File
Parameter 1 specifies the complete name and path of the CSV file.
46.2.2. Parameter 2: Column Separator
Parameter 2 specifies the column separator character.
Valid values are:
- Space
- Comma
- Semicolon
- Tab
46.2.3. Parameter 3-n: List of Variables
Parameter 3-n specifies all variables to be written into the CSV file.
100
101
47.
47.1. Description
The command Write SQL Server writes the actual values of the specified variables into a SQL Server
database.
First, the actual values of the specified placeholder variables are determined and inserted into the
SQL query, then a connection to the database server is established and the SQL command is sent to
the database server. Finally, the connection to the database server is being closed.
Note!
SQL queries are interpreted at runtime by the database engine. Therefore PLC Reports only
performs a basic syntax validation. If an error occurs while executing the command, the message
received from the database engine along with the completed SQL command including the current
placeholder variable values are recorded in the PLC Reports message list.
47.2. Parameters
The command always requires 2 parameters: The connection string and the SQL command.
47.2.1. Parameter 1: Connection String
Parameter 1 specifies the database connection string. Make sure that the syntax matches the SQL
Server connection string syntax. Further information about connection strings can be found in the
Microsoft SQL Server documentation.
Note!
Connection strings might contain commas but PLC Reports as well uses commas as parameter
separators. Therefore, connection strings must be enclosed by quotes.
47.2.2. Parameter 2: SQL Command
Parameter 2 specifies the SQL command. Further information about the SQL command syntax can be
found in the Microsoft SQL Server documentation.
Variable placeholders are used to dynamically insert actual variable values into the SQL command at
the moment the query is executed.
Placeholders are defined in the following format: {#105#}. This example shows a variable placeholder
for variable 105. In addition, make sure to follow the syntax rules for passing values to the SQL
Server. In most cases, values can be passed as text. In this case, the values must be enclosed by
apostrophes: {#105#}
Note!
SQL queries might contain commas but PLC Reports as well uses commas as parameter separators.
Therefore, SQL queries must be enclosed by quotes.
Note!
To avoid interferences with SQL key words, it is recommend to enclose table and column names in
square brackets.
102
103
Invalid Parameters
There is no variable with index: xxx defined
Error reading the value from the PLC
104
48.
Write Variable
48.1. Description
The command Write Variable writes the actual value of the specified variable into the specified
PLC.
Warning!
The command Write Variable overrides the memory area of the PLC which is specified in the
variable definition. PLC Reports does not perform any data type validation of the PLCs destination
memory. Furthermore PLC Reports cannot validate the specified PLC memory address. Incorrect
definitions of data types or addresses may lead to overwrite unintended memory areas of the PLC.
Warning!
Make sure that writing to the specified PLC memory areas does not lead to unintended or dangerous
machine or plant conditions. Validate the write actions with the machine or plant manufacturer.
Warning!
Carefully validate each single write command and check its correct functionality. Never use write
commands in productions environments without prior validation and testing.
48.2. Parameters
The command requires one parameter: The index of the variable to be written.
48.2.1. Parameter 1: Index of the Variable
This parameter specifies the index of the variable to be written into the PLC. This parameter is always
required.
Valid values are indexes of defined variables.
105
106