API Scope.FindOutput
<sidebar>API Contents</sidebar> Searches back through the output history for a value, returns offset of found sample from TimeUS, 0 if not found
Contents
Parameters
HANDLE StreamH
- The stream that is to be read
LONG TimeUS
- The time offset to start the search from, in microseconds
LONG SearchMax
- The maximum number of microseconds to look back over, -ve to search backwards
FLOAT Value
- The target value to search for
ULONG SearchFlags
- A combination of flags to decide how to conduct the search
- Typical values for this parameter:
Name Description Find_Lower Match a search when output is lower than the target value Find_Equal Match a search when output is equal to the target value Find_Higher Match a search when output is greater than the target value Find_LowHigh Match a search when output goes lower to higher than the target Find_HighLow Match a search when output goes higher to lower than the target
Return value
Returns offset of found sample from TimeUS, 0 if not found
Detailed description
This call allows transitions in the stream to be detected.
The user can specify a time offset (TimeUS), which is typically negative, as an offset from the present time.
The search can either step forwards or backwards, based on the sign of SearchMax, and will search within the range of the SearchMax provided - a value of zero will mean the search never succeeds.
The Value is a reference point. Either an exact match is required, an inequality, or a transition of values spanning the reference point. This criteria is decided by SearchFlags, which may be a combination of the available constants.
If the call fails to find a match then it will return 0 - an offset from the specified TimeUS which should otherwise not be returned.
Examples
Calling in a calculation
- Declare a variable 'result' of type LONG
- Add to a calculation icon:
result = ::Scope.FindOutput(streamh, timeus, searchmax, value, ::Scope.Find_Lower)
No additional examples