Comparing the current value with the previous one in Powershell

Hi,
New to scripting and i was wondering how can I compare the current value with the previous value?
I am having trouble with the loop structure, and I am not sure I am on the right track...
I am trying to compare the record to next record in the same csv file after import-csv... My code runs fine, but is not giving the right result.
$FilePath = Get-FileName -initialDirectory "C:\"
#Testing for null
If($FilePath)
$Data = Import-csv -Path $FilePath | Sort-Object BUYER, {[int] $_.PO_NBR}, {[int] $_.LINE_NBR}
Foreach($fData in $Data)
$i = $fData
Foreach($i in $fData)
if($fData.Buyer -eq $i.Buyer)
#save all the same buyer name to a new variable
Write-Host "Same as previous"
Else
Write-Host "Variable is null"
Remove-Item function:\Get-FileName

Thank you. The Foreach loop is now working properly.
Can I ask what is the purpose of "-ea 0" in the import-csv? I can't seem to find "-ea" as a parameter for import-csv in help.
-ea is short for -ErrorAction.
Don't retire TechNet! -
(Don't give up yet - 13,225+ strong and growing)

Similar Messages

  • Compare current value with previous value

    Hello,
    I would like to compare the current value with the previous value of the current value.
    How can I solve this problem?
    Maurits

    Hi,
    after going through the basics course you surely can understand that example:
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • I just updated my latest java but the update is causing problems with some externale devices. So i would like to uninstall this latest java update and get back the previous one. That should solve to problems with my external device

    i just updated my latest java but the update is causing problems with some external devices. So i would like to uninstall this latest java update and get back the previous one. That should solve to problems with my external device.
    Is this possible and how do i do that?
    Anyone who responds thanks for that!
    Juko
    I am running
    Hardware Overview:
      Model Name:          Mac Pro
      Model Identifier:          MacPro1,1
      Processor Name:          Dual-Core Intel Xeon
      Processor Speed:          2,66 GHz
      Number of Processors:          2
      Total Number of Cores:          4
      L2 Cache (per Processor):          4 MB
      Memory:          6 GB
      Bus Speed:          1,33 GHz
      Boot ROM Version:          MP11.005D.B00
      SMC Version (system):          1.7f10
      Serial Number (system):          CK7XXXXXXGP
      Hardware UUID:          00000000-0000-1000-8000-0017F20F82F0
    System Software Overview:
      System Version:          Mac OS X 10.7.5 (11G63)
      Kernel Version:          Darwin 11.4.2
      Boot Volume:          Macintosh HD(2)
      Boot Mode:          Normal
      Computer Name:          Mac Pro van Juko de Vries
      User Name:          Juko de Vries (jukodevries)
      Secure Virtual Memory:          Enabled
      64-bit Kernel and Extensions:          No
      Time since boot:          11 days 20:39
    Message was edited by Host

    Java 6 you can't as Apple maintains it, and Java 7 you could if you uninstall it and Oracle provides the earlier version which they likely won't his last update fixed 37 remote exploits.
    Java broken some software here and there, all you'll have to do is wait for a update from the other parties.

  • HT4623 How can I get rid of this new update and go back to the previous one and how can I register a complaint with Apple?

    How can I get rid of this new 7.0.2 update and go back to the previous one and how can I register a complaint with Apple?

    You can't go back.
    You can leave feedback: http://www.apple.com/feedback

  • Salary in the current month and  the previous one

    Hi
    I have a table that stores payroll details like the following stracture
    earn code
    period from
    period to
    user_id
    time
    I want to do one report which displays both the salary of one employee in the current month and his salary is the previous one
    Thank you for your help

    you might use the LAG-function to get the previous months salary. Hard to know, as you did not provide any information about your report and database versions.

  • Ive purchased a black coloured iphone 5s but i dont like the colour, can apple replace my current phone with a white one?j

    Ive purchased a black coloured iphone 5s but i dont like the colour, can apple replace my current phone with a white one?j

    If you purchased your iPhone from Apple within the last 14 days then you can return it to switch it for another color if you wish.
    If you purchased it through your carrier, then you will need to look at their returns policy, but I expect it would be similar.

  • HT204053 I created a new apple id because the previous one no longer exists as email (domain had to be cancelled). I keep seeing the old one pop up in my iPhone for which I don't remember the password. How can I get rid of it???

    I created a new apple id because the previous one no longer exists as an email (domain had to be cancelled). I keep seeing the old one pop up in my iPhone for which I don't remember the password. How can I get rid of it??? Or how can I reset the password if the email doesn't exist??? I also tried answering a question (my date of birth) but it says it's wrong.
    I'm really frustrated with the apple id!!!
    Frustrated!!!

    In one of the help pages for managing your Apple ID (http://support.apple.com/kb/HE40), it shows two separate sections, one for Apple ID and one for Primary Email address. When I go to manage my Apple ID, I see only a single section for both. Can the two be 'separated', especially when you face the situation of having to discontinue your email address for some reason?
    I also noticed that when navigating to Apple ID Support Communities, it shows my nickname 'dishdy'. How and when did I insert this? In the current sequence for creating an Apple ID I don't see this. In my current profile I don't see this.
    In any case, I have freed myself from my previous Apple ID (@artemis.it) on my iPhone.
    Thanks for your help.

  • Hi, please, anybody knows how many coolers has an iMac 27 Intel core i5? The widget iStatpro shows 3. I changed my HD (the previous one of 1TB crashed) and after that the HDD cooler is constantly working at 4.600 rpm. Anybody is facing this problem?

    Hi, please, anybody knows how many coolers has an iMac 27 Intel core i5? The widget iStatpro shows 3. I changed my HD (the previous one of 1TB crashed) and after that, the HDD cooler is constantly working at 4.600 rpm. Anybody is facing this problem?

    Did you replace the HD yourself? If so what HD did you use?
    You should be aware that the symptom you describe is likely to be because you've used an incompatible HD. The current Macs have the temperature sensor actually in the HD package, with a modified cable to connect to the logic board.
    If the sensor is not in circuit, the fans will run full tilt all the time.
    Also, if it was under warranty, I think you'll find you've just voided it.

  • Is the new iphone a much better upgrade to the previous one?

    Well i was hoping to go to my local cellular retailer to check out the new phone, but they havent display it out yet. Just wondering for those of you who got one today, how are you liking it? Is it really worth the upgrade from the previous one?
    How is the video recording? Is it smooth and clear?

    Yes NFSUndercover and Sims 3 run way smoother. No crashing every so often in the Sims either.
    I knew it felt 2x faster immediately, because when you open and close any apps (even texting and such), it is silky smooth with NO hiccup. My 3G felt a bit sluggish, and the games could slow down every so often. 3GS is what the 3G should have been

  • How to activate a new release Strategy Of PR without deleting the previous one?

    Dear  All,
    1=I have a release strategy in purchase requisition which is without classification and active in system.
    2= Now i configured a New Release Strategy for Purchase requisition   which is with classification
    My question is i want to activate the New one with classification  in System without deleting the previous one.
    Should it possible? and How?
    Ritesh.

    Dear  Dev,
    My old release strategy at item level.
    But  the New one  is at header Level.
    But the previous  one  showing  the release Indicator.
    But  when i delete  the old configuration the old release indicator vanishes.
    But the thing is  in Pr with out classification we have same Pr doc.Type
    But in New Configuration We want to at header level  and with same doc   type.
    so without  deleting  the old one if i activate the New Strategy whether the system allow me
    to see the New Release Indicator?
    As  My testing when i deleted the old one the Old indicator in Line item Level vanishes.

  • But how do I create a new iTunes backup password without knowing the previous one?

    In case anyone keeps track of such things, I'm among those folks who really doesn't recall ever being asked to create an iTunes backup password, but that's irrelevant to my question.
    I'm not in any bind. I don't need my backup files to restore anything. I will shed no tears as they are moved to the Recycle Bin (indeed, I will gladly do the deed myself).
    That said, it appears impossible to create a new backup password without knowing the previous one.
    If the only "solution" is to wipe my iPhone's memory and start from scratch, I will be a sad camper.
    Any help? Are backups to iCloud encrypted?
    Cheers...

    Additionally:
    Be super critical & meticulous (and whatever other synonym I missed) when you get a new password:
    Write it onto your bedroom wall, or someplace off of a computer that you will always find.
    If you active 2-step verification, the key is VERY important. Lose it & you may be toast.
    If you don’t 2 step verify, & use the Security Question instead --> do not lose, or forget the answers.
    Very nearly the same outcome!!!!!:  Bad experience.
    If you add a 2nd email address, make sure its a RESCUE address not just an alternate address.
    If you lose these, you lose access to your 3rd party purchases via Appstore for future upgrade. That will make you VEWY, VEWY UNHAPPY. Apple new OS versions do update, but add a new device & likely you will be unable to use your content on that device. It will never load if the ID locks up.

  • Overlap audio regions on 1 track without cutting the previous one off

    Im trying to overlap multiple audio regions on one track, so that the next one starts before the previous one ends but when i do this, each consecutive overlap basically replaces the remaining region of the one before it. to be more specific in order to maybe paint a better picture of what i am asking... i am creating machine gun audio for a video clip and i have a loop of a single shot plus the shell falling to the ground. im trying to overlap the loops so that the single shot of each come together in rapid fire succession to create the machine gun firing sound, but i want the sound of the shell falling for each shot to continue to play under the multiple copies of the overlapping loop. the problem is, when i overlap multiple loops, its not finishing the noise of the shell falling to the ground for each shot, it only plays the falling shell at the very end when there is no other overlap. i hope i did an ok job explaining what i am asking, haha trying to type this out was much more difficult that initially anticipated. thanks in advance for any help.

    That's normal. Audio tracks are not polyphonic. Use several tracks or EXS24.
    Christian

  • When i visit a web page then log out...when i open firefox to visit another webpage, the previous one loads automatically. Why? How do I turn this off?

    When I visit a website, close Firefox, then reopen Firefox to go to another website, the previous one loads automatically. Why? How do I turn this off?

    Change the startup setting:
    Tools > Options > General > Startup: "When Firefox Starts": "Show my home page" or "Show a blank page"

  • Traversing from one screen to the previous one using back button

    Hi all,
            I am new to the forum and want the help of the experts over ther for this doubt i encountered. I want to know how we can traverse from one screen to the  previous one using the back button. Like if presently i am in 4th screen if i want to go back directly to the 2nd one then how to do that.
            Kindly help me by clarifying this doubt.
    Thanks

    Hi Jana,
    If u r using the screen painter then u need to create  a button and in status there.code as set pf-status.
    case sy-ucomm.
    when 'back'.
    leave to screen <screen number> here if u want to go to the other screen i.e to screen 200 ffrm 400 then u can code it as
    leave to screen 400.
    or else code it as
    if screen = '200'.
    leave to screen 400.
    try this eg it might work ..
    regards,
    sana.
    reward points for helpful answers.

  • Opening a file without hearing the previous one....

    How do we do to open a file without hearing the previous one if we open multiples files in a short time without willing to close the previous one each time ??

    How do we do to open a file without hearing the previous one if we open multiples files in a short time without willing to close the previous one each time ??
    If you don't wish to listen to all playing videos and it is too much trouble to stop or close non-foremost player windows, then don't use the QT X (or any similar) media player for playback. (I.e., this is what they are programmed to do.) Instead, use a media player like QT 7 which has a user preference that can be set so that only the "foremost" player window audio is heard when multiple videos are being played simultaneously.

Maybe you are looking for