Has Operator


Has is a new operator available in CSPro 5. Has works like in but on multiply-occurring items instead of a single item occurrence. For example, if relationship is a field on a repeating person record, you might write:

if RELATIONSHIP has 4,5 then // do any of the relationship values have either 4 or 5?

The above code is identical to what could have been written as the following in CSPro 4.1:

if seek(RELATIONSHIP where RELATIONSHIP in 4,5) > 0 then

The has operator makes working with multiply-occurring items a lot easier and intuitive. For example, you might have an item in your dictionary called OPINION that repeats ten times. The data for these ten opinion questions (do you like hamburgers? do you like the color blue? etc.) is keyed into the OPINION field. If the user never enters Yes (1) for any of the fields, then you will skip past a set of questions. You can now write this easily with the has operator:

if not OPINION has 1 then
   
skip to NEXT_FORM;
endif;