We help IT Professionals succeed at work.
Get Started

Assistance with powershell script

sirbounty asked
Last Modified: 2016-07-28
Trying this question again...

I have a stats app that I record a volleyball match onto.  It allows me to send a raw report (gamenotes.txt) of what actions occurred within the game.
A volleyball set is won when one team gets to 25 first, but they must win by 2 points.  A full match is best of 3 or best of 5, depending on the venue/format.  This example is a report from the women's USA match vs Thailand.  It is just the first set, however.  But I think it's a good representation of what could be included.

Each line of the report will begin with the score (0-1) followed by a series of actions that occurred during that one rally.  Each action will have the player's jersey number in parenthesis (unless it's an opponent action, then the 'jersey' will be "THEM").

 (0-1), SR-3( 2), AT(13), BE(25),

A serve came from the opponent and was rated a '3' (SR = serve reception), recorded by player 2.  Player 13 Attempted (AT) to terminate the rally but failed.  Finally player 25 recorded a blocking error (BE).

It's fairly easy to read for the most part, but here's where it gets tricky.  If an action is entered incorrectly, the app doesn't remove it, it records it with a preceding minus sign.  

(9-12), S(10), -S(10), S(13), D(23), E(23),

The score is 9-12.  #10 serves (S).  OOPS - not #10...fix that.  #13 was the server!  #23 gets a recorded dig (D) and #23 ends the rally with a hitting error (E).

The down side is that the correction may not immediately follow the goof. :(  So it may require working backwards until the exact same action/player combination is found.

I have most of the code written for what I'm doing so far.  However, I ultimately want to evolve this into something helpful for reporting on the statistics.  For example, If #13 at the end of the set/match has 20 attempts, kills 15 of those and only errors once, I would want to display her hitting % which is calculated by (K-E)/AT, or in this case 70%.

I'll just upload the report file for now in case someone wants to come up with their own solution for looping through the data.  But I'll be glad to post my current script if desired.
Watch Question
Co-Founder and Chief Architect
Top Expert 2016
This problem has been solved!
Unlock 2 Answers and 13 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE