# Exists

The purpose of this function is to test if one or more fields (or a named variable) exists (are non empty) or do not exist (are empty). Numeric fields such as Track, Season, etc. are also treated as empty if their value is zero. This is due to the fact that numeric fields with a value of zero are intrinsically empty. The statement can also test named variables and fields supplied in a named variable. More information is given in Statement Source/Target Determination regarding the runtime determination of which fields to test. In earlier releases of Yate, the statement supported the specification of an inline list of fields. The specification did not have to be a named variable. For consistency reasons, this mode is deprecated. If you edit the statement and change the source mode, this setting will no longer be available.

When the function mode is Test, the result of the test will be true if at least one field matches the desired condition. If no fields match the desired condition, the result of the test will be false. The function typically stops in stepwise mode if any selected file meets the test criteria. You can elect to Set, And, or OR the result to the action test state. In the case of a results mode of AND or OR, the test is only performed if meaningful. If you only want to test one field, you can use the Compare Text Text statement which has far more options and supports a looser definition of exists. (ie. leading and trailing spaces can be ignored).

When fields are being tested, either directly or from a list in a named variable, you can opt to save the result to a track variable. The same Set, AND, OR semantics are performed. When this option is enabled, the statement will run over all files even if the execution does not have to proceed to determine the resultant value of the action test state.

When the function mode is Report, if at least one field matches the desired condition, action processing will be paused and the Action Pending Window will be presented. You can make whatever changes you desire and resume the action. Alternately, you can cancel the action step and continue. While batch processing, the fact that the condition was met will be logged.

If the statement's source mode is processing a list of field names and the runtime list contains no valid field items, the statement will silently terminate. In this case when the function mode is Test, the test state will be set to false.