# GetNameValueListItem

### int GetNameValueListItem(int lMsgId, string sDelimiter, ref string psNameList, ref string psValueList, ref int plCount)

수신된 SECS 메시지 내에서 `L[n]` 안에 `L[2]` 형식(Name-Value Pair)으로 반복되는 아이템들을 찾아, 사용자가 지정한 구분자로 연결된 두 개의 문자열(`psNameList`, `psValueList`)로 반환합니다.

Parameters

<table data-header-hidden><thead><tr><th width="174"></th><th width="113"></th><th></th></tr></thead><tbody><tr><td><strong>Name</strong></td><td><strong>Type</strong></td><td><strong>Description</strong></td></tr><tr><td>lMsgId</td><td>int</td><td>데이터를 추출할 수신 메시지의 고유 식별 ID</td></tr><tr><td>sDelimiter</td><td>string</td><td>아이템 간의 연결에 사용할 구분자 문자열 (예: ",", "|")</td></tr><tr><td>psNameList</td><td>ref string</td><td>추출된 모든 이름(첫 번째 Sub Item)들이 구분자로 연결된 문자열</td></tr><tr><td>psValueList</td><td>ref string</td><td>추출된 모든 값(두 번째 Sub Item)들이 구분자로 연결된 문자열</td></tr><tr><td>plCount</td><td>ref int</td><td>실제로 추출된 Name-Value 쌍의 총 개수</td></tr></tbody></table>

```csharp
// 1. 데이터 수신에 필요한 변수 준비
string sNames = "";      // 이름들이 합쳐져서 들어올 변수
string sValues = "";     // 값들이 합쳐져서 들어올 변수
int itemCount = 0;       // 총 개수 (n값)
string delimiter = "|";  // 각 항목을 구분할 기호

// 2. 라이브러리 함수 호출 (lMsgId는 수신 이벤트에서 받은 ID)
int nResult = m_gem.GetNameValueListItem(lMsgId, delimiter, ref sNames, ref sValues, ref itemCount);

if (nResult >= 0 && itemCount > 0)
{
    // 3. 수신된 문자열을 배열로 분리하여 사용 (Split 활용)
    string[] nameArray = sNames.Split(new[] { delimiter }, StringSplitOptions.None);
    string[] valueArray = sValues.Split(new[] { delimiter }, StringSplitOptions.None);

    // 4. 반복문을 통한 개별 데이터 접근
    for (int i = 0; i < itemCount; i++)
    {
        string name = nameArray[i];
        string val = valueArray[i];
        Console.WriteLine($"항목[{i}]: {name} = {val}");
    }
}
else
{
    Console.WriteLine("데이터가 없거나 오류가 발생했습니다. 에러코드: " + nResult);
}
```


---

# 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/getnamevaluelistitem/getnamevaluelistitem-1.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.
