LowCode (Mendix) Advanced/Constrain Your Data Using Advanced XPath

Constraint Functions & Logical Operators

Caryou 2024. 10. 18. 11:21

학습 목표

이 모듈을 마치면 다음을 수행할 수 있습니다.

  • 문자열과 DateTimes를 조작하여 Xpath 함수를 적용하여 데이터를 검색합니다.
  • "and", "or" 및 "not"을 포함한 논리 연산자 사용
  • 최상의 성능을 위해 논리 연산자를 사용할 때 최상의 방법을 적절하게 구현합니다.

 


일반 기능

Mendix는 XPath 쿼리를 작성할 때 사용할 수 있는 일련의 함수를 제공합니다. 이러한 함수는 주로 속성의 특성에 따라 데이터를 필터링하는 데 사용됩니다. 전체 목록은 documentation에서 찾을 수 있습니다.

 

예시) contains

 [contains(Name, 'an')]     ( ※ unlimited 로 설정된 속성을 쓰지 않도록 유의 )

 

 

분기당 판매량

[quarter-from-dateTime( DateAttribute ) = 1]

 

 

 

 

논리 연산자

논리 연산자를 사용하면 XPath 쿼리를 작성할 때 조건을 결합할 수 있습니다. Mendix는 두 개의 연산자 and와 or를 지원합니다.

 

And 연산자 사용

기본적으로 대괄호로 나누면 and 연산자가 자동으로 결합됩니다.

// 1
[Available = true()
and
Active = false()]

// 2
[Available = true()]
[Active = false()]

 

 

Or 연산자 사용

[Color = 'Black'
or
Color = 'Silver/Black']

 

 

not 함수

not 함수는 부울 값 / 연결 확인 체크가 가능합니다.

단점으로는 느린 쿼리를 생성합니다.

[not(BoolAttribute)]

[not(Production.Product_ProductSubcategory/Production.ProductSubcategory)]

 

 

출처 : https://academy.mendix.com/link/paths/109/Constrain-Your-Data-Using-Advanced-XPath

참고 : https://docs.mendix.com/refguide/xpath-constraint-functions/

 

XPath Constraint Functions

The following pages describe the functions that can be executed within constraints: true false not length string-length year-from-dateTime month-from-dateTime day-from-dateTime hours-from-dateTime minutes-from-dateTime seconds-from-dateTime quarter-from-da

docs.mendix.com

 

'LowCode (Mendix) Advanced > Constrain Your Data Using Advanced XPath' 카테고리의 다른 글

Normalization and Denormalization  (0) 2024.10.18
Optimization  (0) 2024.10.18
Data Querying  (2) 2024.10.17