IPen.AddSample
- Last UpdatedJun 11, 2024
- 2 minute read
Adds a temporary sample to a pen.
Note: The pen you are adding samples to needs to have the Server field in the Data Connection properties set to <Unbound>. See Configure the Pen Data Connection.
Defined As
-
[VBA] AddSample(value As Double, timeStamp as Date, milli as Integer, qualityType as Integer, compactionType as Integer)
-
[Cicode] AddSample(REAL value, DATE timeStamp, INT milli, INT qualityType, INT compactionType)
-
[C++] HRESULT AddSample(double value, DATE timeStamp, short milli, QualityType qualityType, QualityCompactionType compactionType)
Parameters
value
[in] Indicates the value of the sample that will be added.
timeStamp
[in] Indicates at what time the sample will occur in UTC time.
milli
[in] Indicates the millisecond component of the time stamp (0 to 999).
qualityType
[in] Indicates the quality of the sample that will be added.
compactionType
[in] Indicates what display type the sample will be represented as.
Execution Result
If the function succeeds, the return value will be Success. If an argument is bad, the return value will be InvalidArgument. If an argument is out of range, the return value will be InvalidArgument. If the pen is deleted, the return value will be GeneralFailure. If any other unexpected error occurs, the return value will be GeneralFailure.
Remarks
You can only add samples to analog or digital pens.
This function has limited use as the samples added are stored in a temporary cache; they can be cleared anytime by time span changes, data refresh calls, or automation. You can change this behavior using IPen.ClearOnResolutionChange [Property][Get/Set].
Calling Syntax
Assumes you have passed a valid pen object into the function.
[VBA]
Sub Example(pen As Object)
Dim timeStamp As Date
timestamp = Now
pen.AddSample 75.0, timeStamp, 100, 0, 0
End Sub
[Cicode]
FUNCTION Example(OBJECT hPen)
INT iCitectTime;
REAL rOleTime;
iCitectTime = TimeCurrent(); // Returns seconds since 1970
rOleTime = TimeToOleDate(iCitectTime, 1); // Convert to OLE UTC time
_ObjectCallMethod(hPen, "AddSample", 75.0, rOletime, 100, 0, 0);
END