> For the complete documentation index, see [llms.txt](https://nviasoft.gitbook.io/nviasoft-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nviasoft.gitbook.io/nviasoft-docs/api-reference/item-parsing/getsubitemformat.md).

# GetSubItemFormat

### int GetSubItemFormat(int lMsgId)

수신한 SECS 메시지의 현재 위치에 있는 아이템의 \*\*데이터 형식(Format Type)\*\*을 반환합니다.

SECS II 표준에 정의된 포맷 코드 값들을 반환하므로, 이 값을 확인하여 다음에 호출할 데이터 추출 함수(예: GetAsciiItem(), GetU1Item()등)를 결정할 수 있습니다.

Parameters

<table data-header-hidden><thead><tr><th width="224" valign="top"></th><th width="112" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Name</td><td valign="top">Type</td><td valign="top">Description</td></tr><tr><td valign="top">lMsgId</td><td valign="top">int</td><td valign="top">수신한 Message의 ID</td></tr></tbody></table>

Return Value

<table data-header-hidden><thead><tr><th width="149" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Value</td><td valign="top">Description</td></tr><tr><td valign="top">>=0</td><td valign="top"><p>0 = List</p><p>10 = BINARY,   11 = BOOLEAN,   20 = ASCII,   21 = JIS-8,   30 = INT8,</p><p>31 = INT1,   32 = INT2,   34 = INT4,   40 = FLOAT8,   44 = FLOAT4,</p><p>50 = UINT8,   51 = UINT1,   52 = UINT2,   54 = UINT4</p></td></tr><tr><td valign="top">&#x3C;0</td><td valign="top">더 이상 Next Item이 없음</td></tr></tbody></table>

```csharp
 // 현재 아이템의 포맷 확인
 int format = m_gem.GetSubItemFormat(lMsgId);

 switch (format)
 {
     case 0:  // List
         int count = m_gem.GetSubItemCount(lMsgId);
         Console.WriteLine($"Item is a List with {count} elements.");
         break;

     case 20: // ASCII
         string val = "";
         m_gem.GetAsciiItem(lMsgId, ref val);
         Console.WriteLine($"Item is ASCII: {val}");
         break;

     case 34: // INT4
         int intVal = 0;
         m_gem.GetI4Item(lMsgId, ref intVal);
         Console.WriteLine($"Item is INT4: {intVal}");
         break;

     default:
         if (format < 0)
             Console.WriteLine("No more items or error.");
         break;
 }
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://nviasoft.gitbook.io/nviasoft-docs/api-reference/item-parsing/getsubitemformat.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
