데이터 테이블 컬럼을 나누고 싶습니다

데이터 테이블에 있는 컬럼을 특정문자를 기준으로 나눠서 다음 컬럼으로 옮기고 싶은데 어떻게 해야하나요?
예를 들면 1컬럼에 있는 내용 밥/빵 을 /기준으로 나눠서 1컬럼 밥 , 2컬럼 빵 이렇게 나누고싶습니다

@kqzx001

Make sure you are the additional columns you would be expecting to add data and then use this linq query in assign activity.

Initialize the dtResult variable using assign activity like this

dtResult= dtInput.Clone

Now use this in assign activity.

dtResult = (
    From r In dtInput.AsEnumerable()
    Let parts = r("Column1").ToString.Split("/"c)
    Let newRow = dtResult.Rows.Add(
        parts(0).Trim,
        If(parts.Length > 1, parts(1).Trim, String.Empty)
    )
    Select newRow
).CopyToDataTable()

Hi @kqzx001

서 데이터테이블의 한 컬럼 값을 / 기준으로 나누려면 For Each Row 안에서 Assign 활동을 사용해 parts = row("Column1").ToString.Split("/"c) 라고 작성합니다. 그 다음 다시 Assign 활동으로 row("Column1") = parts(0)row("Column2") = parts(1) 을 지정하면 됩니다. 이렇게 하면 밥/빵이 자동으로 첫 번째 컬럼에는 , 두 번째 컬럼에는 으로 나누어 저장됩니다. 도움이 되셨다면 답변 옆에 있는 체크 표시로 해결됨을 표시해 주세요.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.