GetFieldsOnLayout

레이아웃의 필드 목록을 JSON 데이터로 반환합니다.

포맷 

GetFieldsOnLayout( layoutName )

매개 변수 

layoutName - 레이아웃의 이름을 나타내는 텍스트 표현식입니다. layoutName이 빈 문자열(")인 경우, 현재 레이아웃이 사용됩니다.

반환되는 데이터 유형 

텍스트

다음 버전에서 시작됨 

22.0

설명 

이 함수는 찾기에 액세스할 수 있는 지정된 레이아웃의 필드에 대한 정보를 포함하는 JSON 객체를 반환합니다.

다음 기준을 충족하는 필드는 제외됩니다.

반환된 JSON 객체의 구조는 다음과 같습니다.

복사
{
    "layout_name": "LayoutName",
    "fields": {
        "TableOccurrence::FieldName1": {
            "type": "string",
            "description": "Field comment (optional)"
        },
        "TableOccurrence::FieldName2": {
            "type": "number"
        }
    }
}
  • layout_name 키에는 레이아웃의 이름이 포함되어 있습니다.

  • 필드 객체에는 각 접근 가능한 필드에 대한 키-값 쌍이 포함되어 있습니다.

  • 각 필드의 키는 정규화된 이름입니다(예: TableOccurrence::FieldName).

  • 각 필드의 값은 type 키가 있는 객체입니다(필드의 데이터 유형이 숫자인 경우 number; 그렇지 않은 경우 string).

  • 필드에 데이터베이스 관리 대화 상자의 주석이 있는 경우 선택적 description 키가 포함됩니다. 테이블의 필드 주석이 [LLM]으로 시작하는 경우 [LLM]으로 시작하는 주석만 표시됩니다. [LLM] 접두사가 description 값에서 제거됩니다.

참고 

예제 1 

제품 레이아웃에서 찾기에 액세스할 수 있는 필드를 설명하는 JSON 객체를 반환합니다.

복사
JSONFormatElements ( GetFieldsOnLayout ( "Products" ) )

제품 레이아웃에 다음 필드가 있는 경우:

필드 이름 설명

CreationDate

[LLM] 제품 생성일

Price

[LLM] 제품의 가격(USD)

ProductID

[LLM] 제품을 고유하게 식별하는 기본 키

ProductName

[LLM] 제품의 자세한 이름

Status

인벤토리에 있는 제품의 상태. 값: 재고 있음, 주문 시

g_UserFavorites

현재 사용자가 즐겨찾는 제품을 포함하는 글로벌 필드

함수는 다음을 반환합니다.

복사
{
    "fields"
    {
        "Products::CreationDate"
        {
            "description" : "Creation date for product",
            "type" : "string"
        },
        "Products::Price"
        {
            "description" : "Price of the product in USD",
            "type" : "number"
        },
        "Products::ProductID"
        {
            "description" : "Primary key that uniquely identifies a product",
            "type" : "number"
        },
        "Products::ProductName"
        {
            "description" : "Descriptive name of the product",
            "type" : "string"
        },
        "Products::Status"
        {
            "type" : "string"
        }
    },
    "layout_name" : "Products"
}

하나 이상의 필드 주석은 [LLM] 태그로 시작하기 때문에 [LLM] 태그가 있는 필드에만 설명이 포함됩니다. g_UserFavorites 필드는 찾기에 액세스할 수 없는 글로벌 필드이기 때문에 완전히 생략됩니다.

예제 2 

현재 레이아웃의 모든 필드 목록과 찾기로 액세스할 수 있는 현재 레이아웃의 모든 필드 목록을 반환합니다. 이는 알지 못했던 필드가 찾기에 액세스할 수 없음을 나타낼 수 있습니다.

복사
Let (
[
    layoutFields = FieldNames ( Get ( FileName ) ; Get ( LayoutName ) ) ;
    findFields = JSONListKeys ( GetFieldsOnLayout ( Get ( LayoutName ) ) ; "fields" ) ;

    sortedLayoutFields = SortValues ( layoutFields ; 1 ) ;
    sortedFindFields = SortValues ( findFields ; 1 ) ;

    $$result = "All fields on the current layout:" & ¶ & sortedLayoutFields & ¶ & 
    "Of these, the fields accessible to a find are:" & ¶ & sortedFindFields
] ;
$$result
)

제품 레이아웃에 대한 $$result에 저장된 가능한 출력:

복사
현재 레이아웃의 모든 필드:
CreationDate
Photo
Price
ProductID
ProductName
Status

찾기에 액세스할 수 있는 필드:
Products::CreationDate
Products::Price
Products::ProductID
Products::ProductName
Products::Status