Foreach loop

Welcome Forums General PowerShell Q&A Foreach loop

This topic contains 2 replies, has 3 voices, and was last updated by

9 months, 4 weeks ago.

  • Author
  • #116599

    Topics: 1
    Replies: 0
    Points: 13
    Rank: Member

    I am connecting to smartsheet api and I am looping through the page to get all the values and insert them to mssql table. However when inserting, sometimes it skips the last value, it seems it is in the memory but is not inserted to the table.

    Thank you.

  • #116694

    Topics: 2
    Replies: 454
    Points: 1,005
    Helping Hand
    Rank: Community Hero

    I think we'll probably need to see what you're trying to do with your code in order to be able to spot if there's anything you're overlooking, or if it's a failing in the API somewhere. 🙂

  • #118597

    Topics: 0
    Replies: 13
    Points: 9
    Rank: Member

    Definitely need to see some code to provide any feedback.

    Are you using the foreach keyword or the foreach-object cmdlet. It can be confusing but they are not exactly the same thing. The problem you're describing sounds like a frequent problem that users of a do while loop experience, in that you've satisfied your exit criteria before completing what you wanted to do.

The topic ‘Foreach loop’ is closed to new replies.