Forum Discussion

Egg's avatar
Egg
Frequent Contributor
11 months ago
Solved

For loop

Hello. I have a question about 'For Loop' 

 

I read csv file's first cell value. 

and I change that value string to int. 

and I wanna +1 from that value. 

So I write like below.

 

 

 

the first cell's value is  '1'. 

I expected  1, 2, 3, 4  log. 

but that print only 1, 1, 1, 1 

How can i fix this script? 

Pleas share your thinking . 

Thank you . 

 

  • Like this?

    The value doesn't change anywhere so it will post the same one every time.

    I also suggest converting string to int before using the loop.

  • For me aqconvert.StrToInt() works just fine, I noticed you have not filled in the loop variable be sure to have a empty int variable just for this, for loop counts that var +1 every loop automatically.

    In my example loop it first converts string to Int, then within the loop it does +1 and posts a log.

     

4 Replies

  • MW_Didata's avatar
    MW_Didata
    Regular Contributor

    Like this?

    The value doesn't change anywhere so it will post the same one every time.

    I also suggest converting string to int before using the loop.

    • Egg's avatar
      Egg
      Frequent Contributor

      Now, I know why my for loop didn't work. 

      I did this convert code expression. 

      but that didn't change str to int. 

      How can I fix this? 

      Please share your code 

      ( also I tried  'var to int'   code. but that also didn't change to int) 

       

       

       

  • MW_Didata's avatar
    MW_Didata
    Regular Contributor

    For me aqconvert.StrToInt() works just fine, I noticed you have not filled in the loop variable be sure to have a empty int variable just for this, for loop counts that var +1 every loop automatically.

    In my example loop it first converts string to Int, then within the loop it does +1 and posts a log.