존재 테스트 조건

데이터 세트에 특정 유형의 비즈니스 용어가 하나 이상 있는지 여부를 검사하는 조건을 빌드할 수 있습니다.

다음 정의는 지정된 데이터에 대해 테스트하는 연산자를 포함합니다.

there are

there are 연산자는 규칙을 호출하는 애플리케이션에서 데이터에 있는 특정 유형의 비즈니스 용어가 특정 수만큼 있는지 여부를 테스트합니다.

다음 조건은 2명의 고객을 확인합니다.

if
   there are 2 customers
then... 

where 연산자를 사용하여 비즈니스 용어에 적용할 추가 조건을 지정할 수 있습니다.

10명의 고객이 있는 경우와 각 고객이 골드 카테고리의 구성원인 경우에만 다음 규칙 조건이 true입니다.

if
   there are 10 customers where the category of each customer is Gold,
then... 
there are at least 및 there are at most

다음 연산자는 데이터에 포함된 비즈니스 용어의 인스턴스가 지정된 수보다 많은지 적은지를 검사합니다.

  • there are at least: 비즈니스 용어의 발생 수가 지정된 수 이상인 경우 이 조건은 true입니다.

  • there are at most: 비즈니스 용어의 발생 수가 지정된 수 이하인 경우 이 조건은 true입니다.

다음 조건은 3명 이하의 골드 고객이 있는지 검사합니다.

if
	there are at most 3 customers
		where the category of each customer is Gold,
then... 

다음 조건은 골드 고객이 실버 고객보다 많은지 여부를 검사합니다. 규칙이 다음 변수를 정의하여 시작됩니다.

  • silver customers: 실버 카테고리의 고객 목록입니다.

  • silver count: 실버 카테고리의 고객 수입니다.

그러면 규칙이 이러한 변수를 사용하여 골드 고객 수를 실버 고객 수와 비교합니다.

definitions 
	set 'silver customers' to all customers
		where the category of each customer is Silver;
	set 'silver count' to the number of 'silver customers
if
	there are at least (’silver count’ + 1) customers
		where the category of each customer is Gold,
then... 
there is at least one

BAL 연산자 there is at least one은 규칙을 호출하는 애플리케이션에서 데이터에 있는 비즈니스 용어의 인스턴스가 하나 이상 있는지 검사합니다. 데이터에는 비즈니스 용어의 인스턴스가 둘 이상 포함될 수 있습니다.

다음 조건에서 하나 이상의 customer 오브젝트를 찾습니다.

if
	there is at least one customer
then... 

다음 예제에서는 한 명 이상의 시니어 골드 고객이 있는지 검사합니다.

definitions
   set ’gold customers’ to all customers
      where the category of each customer is Gold;
if
   there is at least one customer in ’gold customers’
      where the age of this customer is at least 65,
then...