2016-08-01 2 views
0

'N/Search'모듈의 괄호를 사용하여 필터 조건을 추가하고 싶습니다.'N/search'모듈 필터에 괄호가있는 필터 조건을 추가하는 방법

Netsuite의 저장된 검색 옵션 (사용자 인터페이스)에 조건과 함께 괄호 "()"가 추가되었지만 "SuiteScript 2.0 버전"필터 배열에서 괄호 안에 조건을 추가하지 않습니다.

I는 아래 이미지 이런 괄호 내의 조건을 추가 할 :

[1]

[필터 어레이 (SuiteScript)]의 괄호 조건을 필터링하는 방법 [1]! '

내 코드 :

filters = [ 
    ['custrecord_employee_name', 'is', employeeId], 'AND' 
    ['custrecord_item_category', 'is', ItemCategoryId], 'AND', 
    ['custrecord_commissions_owner', 'is', BookOwnerID], 'AND', 
    ['custrecord_form', 'is', formId], 'AND', 
    (
    ['custrecord_from_date', 'onorbefore', createdDate], 'OR' 
    ['custrecord_from_date', 'onorafter', createdDate] 
), 'AND', 
    (
    ['custrecord_end_date', 'onorbefore', endDate], 'OR', 
    ['custrecord_end_date', 'onorafter', endDate] 
) 
]; 

답변

3

배열의 새로운 레이어와 함께 필터 식, 그룹화 조건을 사용하여. 코드에서 괄호를 대괄호로 바꿉니다. 또한 filtersvar으로 함수의 어딘가에 선언하여 전역이 아닌지 확인하십시오.

var filters = [ /* use var to avoid global */ 
    ['custrecord_employee_name', 'is', employeeId], 'AND' 
    ['custrecord_item_category', 'is', ItemCategoryId], 'AND', 
    ['custrecord_commissions_owner', 'is', BookOwnerID], 'AND', 
    ['custrecord_form', 'is', formId], 'AND', 
    [ /* array here instead of parens */ 
    ['custrecord_from_date', 'onorbefore', createdDate], 'OR' 
    ['custrecord_from_date', 'onorafter', createdDate] 
    ], 'AND', 
    [ /* and again here */ 
    ['custrecord_end_date', 'onorbefore', endDate], 'OR', 
    ['custrecord_end_date', 'onorafter', endDate] 
    ] 
]; 

나는 모두 당신의 데이트 필터가 달성하고있는 것이 확실하지 않습니다. createdDateendDate의 경우 모두 on, before 또는 after 일 수 있으며 레코드의 해당 필드는 기본적으로 모든 날짜입니다.

실제로 이러한 필터로 검색하려고하는 것은 무엇입니까?

+0

안녕하세요 Erictgrubaugh, Requiement를 기반으로 작업하려고하는 필자의 요구 사항과 함께 필자의 질문을 수정했습니다. –

관련 문제