AddTrace method (TrendPro object)

Adds a new trace to the runtime chart. This method returns
True
if the trace was successfully added to the trend,
False
if the trace was not added.
Syntax
TrendPro1
.
AddTrace
(
String tagName
, [
String
dataLogName
], [
Boolean isHistorian
], [
Integer iType
]) As
Boolean
where
TrendPro1
- is the name of a TrendPro object or an expression that evaluates to a TrendPro object.
tagName
- is a parameter of the type String that specifies the name of the trace to add to the trend.
dataLogName
- is an optional parameter of the type String that specifies the Data Log model name, DataLogPro group name, FactoryTalk Historian connection name, Asset Framework connection name, or PI Server name.
isHistorian
- is an optional parameter of the type Boolean. If set to
true
, it specifies that this trace is a FactoryTalk Historian tag. If a value is not provided, the default is
false
.
Note
: This parameter is maintained to ensure compatibility with previous versions of VBA. For specifying the data source, we recommend using
dataLogName
and
iType
.
iType
- is a parameter of the
TrendTraceType
constant that specifies the trace type.
Note
: The parameter is optional for
FactoryTalk
Live Data, Data Log, and FactoryTalk Historian, maintaining compatibility with previous versions of VBA.
We recommend using the following types to specify the data source:
  • TraceTypeEmpty
    (0): Uses the default trace type, Live Data.
  • TraceTypeLiveData
    (1): FactoryTalk Live Data tags.
  • TraceTypeDataLog
    (2): FactoryTalk View SE data log model tags.
  • TraceTypeHistorian
    (3): FactoryTalk Historian tags (or points).
  • TraceTypeAlarm
    (4): FactoryTalk Alarms and Events history.
  • TraceTypeDiagnostic
    (5): FactoryTalk AssetCentre diagnostic logs.
  • TraceTypePIServer
    (6): PI Server tags (or points).
  • TraceTypeDataLogProPlus
    (7): FactoryTalk View SE DataLogPro tags.
  • TraceTypeAF
    (8): FactoryTalk Historian Asset Framework tags (or attributes).
Return Value
- If
true
, it is a valid, online tag. If
false
, it is an invalid or offline tag. Note that if a Data Log or Historian tag has to fall back to the Live Data tag, this returns
true
because it is still a valid, online tag.
If a Data Log or Historian name is provided, and the tag is not found, TrendPro will fall back to determine if it is a Live Data tag, and if so, will add the trace as a Live Data tag.
Example
Private Sub btnAddTrace() Dim result As Boolean 'Add a trace for the Live Data tag system\Second. result = TrendPro1.AddTrace("system\Second") 'Add a trace for a tag named MyTag that exists in a Data Log named MyDataLog. result = TrendPro1.AddTrace("MyTag", "MyDataLog", , TraceTypeDataLog) 'Add a trace for a tag from Historian Server. result = TrendPro1.AddTrace("CLX_77.DataServer:RSLinx Enterprise:clx.HartBeat_Bit", "Production Historian", , TraceTypeHistorian) 'Add a trace for a FTAE alarm from FactoryTalk Linx Server. result = TrendPro1.AddTrace("Line1_Data:FactoryTalk Linx:[CookieLine]Program:Depositor.Depositor_BearingVibAlarm", , , TraceTypeAlarm) 'Add a trace for a FTAE alarm from Alarms and Events Server. result = TrendPro1.AddTrace("Line1_Alarms:Line1_TagFTAE:DriveCurrent", , , TraceTypeAlarm) 'Add a trace for the Audit information from the diagnostics. result = TrendPro1.AddTrace("Audit", , , TraceTypeDiagnostic) 'Add a trace for CDT_158 from the PI Server connection PIServer1. result = TrendPro1.AddTrace("CDT_158", "PIServer1", , TraceTypePIServer) 'Add a trace for a tag named LogTag that exists in the DataLogPro. result = TrendPro1.AddTrace("LogTag", "DataLogPro", , TraceTypeDataLogProPlus) 'Add a trace for a motor speed from the Asset Framework connection Production Asset Framework. result = TrendPro1.AddTrace("Line1.Motor.Speed", "Production Asset Framework", , TraceTypeAF) End Sub
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal