Foreach loop

Welcome Forums General PowerShell Q&A Foreach loop

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

 
Participant
1 month, 3 weeks ago.

  • Author
    Posts
  • #116599

    Participant
    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

    Participant
    Points: 297
    Helping Hand
    Rank: Contributor

    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

    Participant
    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.

You must be logged in to reply to this topic.