troubleshooting Question

Assistance with powershell script

Avatar of sirbounty
sirbountyFlag for United States of America asked on
Powershell
13 Comments2 Solutions99 ViewsLast Modified:
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").

Example:
 (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.  

Example:
(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.
SOLUTION
Dustin Saunders
Co-Founder and Chief Architect

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Top Expert 2016

The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.

Join our community to see this answer!
Unlock 2 Answers and 13 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 13 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros