For each row 관련 질문

안녕하세요
하나 질문이 있어 문의드립니다
for each를 돌리려고 하는데 혹시 Str_number라는 변수를 돌아갈때마다 초기값은 1이고 돌아갈때마다 +1씩 시키고 싶습니다
어떻게 해야될까요?

@111230

As it is in loop it will increment one by one and you no need to specify any counter variable separately.

I will specify a specific variable and enter it, so I need a variable.

@111230

Then assign below value to that variable.

       Int count = yourDT.Rows.IndexOf(row)+2

Note: Here, index will start from zero and If your input data contains header add +2 as mentioned above else add +1.

For each 돌리기 전에 Assign 액티비티에 Str_number 변수값을 1로 대입시키시고, For each 내부에 Assign 액티비티 넣고, To 속성에는 Str_Number 를, Value 속성에는 Str_Number + 1 을 입력하세요. 그런데 변수명이 Str_number 인걸 봐선 변수 유형이 String 같네요? Int32로 변경하셔야 합니다.

@111230

0으로 초기화 된 "counter"Int32 변수를 만들고 Foreach 루프 범위를 만듭니다.
마지막으로 For 루프 추가에서 할당 카운터 = 카운터 +1

아 감사합니다ㅎㅎ

For each 위에 Int_Number를 1로 지정해주시고
For each 속성에 보면 Index가 있습니다.
Index에 Int_Number 변수 넣어주시면 초기값1부터 +실행횟수로 출력됩니다.(두번째 사진 참고)

image
image

1 Like