Methods for sample streams
- Last UpdatedApr 08, 2025
- 2 minute read
In most cases, you will configure an expression to return the last known sample.

Use a method in an expression
If you want to return a sample other than the last known sample, you can use a method in the expression.

List of methods that return a sample
-
Samples.LastSample
-
Samples.LastGoodSample
-
Samples[int]
-
Samples[DateTime]
Samples.LastSample
|
Description |
Returns the last sample in the sample stream. |
|
Returns |
Returns a sample. |
Samples.LastGoodSample
|
Description |
Returns the last good sample in the sample stream. |
|
Returns |
Returns a sample. |
Samples[int]
|
Description |
Returns the sample at the specified index position in the sample stream. |
|
Returns |
Returns a sample. |
Samples[DateTime]
|
Description |
Returns the sample that occurs on or before the specified timeStamp. |
|
Returns |
Returns a sample. |
List of methods that return an index position
-
IndexBefore(DateTime timeStamp)
-
IndexOnOrBefore(DateTime timeStamp)
-
IndexAfter(DateTime timeStamp)
-
IndexOnOrAfter(DateTime timeStamp)
IndexBefore(DatetTime timeStamp)
|
Description |
Returns the index of the last sample that occurs before the specified time stamp. |
|
Returns |
Returns an integer. The index of the last sample that occurs before the time stamp. If the time stamp occurs on or before the first sample -1 is returned. |
IndexOnOrBefore(DateTime timeStamp)
|
Description |
Returns the index of the last sample that occurs on or before the specified time stamp. |
|
Returns |
The index of the last sample that occurs on or before the time stamp. If the time stamp occurs before the first sample -1 is returned. |
IndexAfter(DateTime timeStamp)
|
Description |
Returns the index of the first sample that occurs after the specified time stamp. |
|
Returns |
The index of the first sample that occurs after the time stamp. If the time stamp occurs on or after the last sample -1 is returned. |
IndexOnOrAfter(DateTime timeStamp)
|
Description |
Returns the index of the last sample that occurs on or after the specified time stamp. |
|
Returns |
The index of the last sample that occurs on or after the time stamp. If the time stamp occurs after the last sample -1 is returned. |