EventLogger

Arguments

The texts of the events can be individualized by programming with "arguments".

A marking with the notation {n} is used for this during the description of the events in the TMC editor, where n is an ascending number starting from 0.

In the TMC editor, for example, such a Display Text is used for an event:

 Grafik aus Argumente (inro4062.png)

This can then be used in the source code as follows:

 

PLC

Arguments can be handled in the PLC as follows:

IF NOT fbResult.EqualsToEventEntryEx(stOther:=TC_EVENTS.CalculationEventClass.DivisionByZero) THEN
    hr := fbResult.CreateEx(TC_EVENTS.CalculationEventClass.DivisionByZero, 0 (*fbSource*) );
END_IF

fbResult.ipArguments.Clear().AddLReal(fDividend); //set Argument

The arguments must thereby be defined after Create()/CreateEx(), but before Send().

Several arguments can be specified in concatenated form.

fbResult.ipArguments.Clear().AddLReal(fDividend).AddString(sMyString);

In this case x is set in place of {0} and sMyString in place of {1}.

 
 

C++

Arguments can be handled in the C++ as follows:

TcArgs tcArgs(m_spMessage);
tcArgs->Clear();
tcArgs.AddArgument(m_dividend);

The arguments must thereby be defined after CreateMessage()/CreateAlarm(), but before Send().

For this, TcEventLoggerTemplate.h must be included in <ProjectName>Interfaces.h.

#include"TcRouterInterfaces.h"
#include"TcEventLoggerTemplates.h"
///<AutoGeneratedContent id="Interfaces">
///</AutoGeneratedContent>
 
 

Output

The output is accordingly:

This notation can also be used as text within the translations.

 
 

Formatting

The output of the arguments can also be formatted. To do this the syntax {n,<Format>} is used accordingly in the TMC editor:

The following formats are available:

Type
Format
Description
Numerical value
d / D
Decimal representation
 
e / E
Exponential representation
 
x / X
Hexadecimal representation
 
f / F
Fixed point

Note that, for example, a REAL cannot be represented as "d" or "x" etc.