Page 1 of 1

Having some trouble using the Editor to import a player's career history

Posted: Tue Feb 22, 2022 9:39 am
by affablePeafowl
I'm using the '98-'99 TBL database and noticed Craig Ludwig had a blank career history. I added a couple of seasons through the editor itself, then exported a spreadsheet, history.xlsx, which I filled out (the one labeled "A" below—figured it'd be better to combine the screenshots rather than post a bunch of 'em, so please pardon the sloppy, hastily-stitched-together screenshots!) Noticed the "Import" buttons in the actual player history window were greyed out (both the Append and Replace options) and assumed you have to go through the "Import Spreadsheet" option. I did so, assuming it would link to Ludwig through the History ID numbers I'd manually inputted, & got a message about an invalid value in A1. By generating the templates, I was able to see the default "history" value should've been changed to "staff_history" instead, so I did, as shown in (A). I got errors in all 29 rows, and the error log is labeled "B" — I didn't quite understand what it was trying to tell me, but I tried using the staff_history template instead, which I've labeled "C". When I was mass-copying his name and DOB over and over again, I figured I was probably still doing something wrong, but being a slow learner, I tried to import it anyway. The resulting error log ("D") brings us to where I am now — again, an error in every row, leaving nothing valid to import.

Image

If anyone's willing to educate me as to what I'm doing wrong, I'd be grateful. I know I'm doing something stupid; I've just got no idea what it is.

Apropos of nothing, the 28.6 hours I've logged on this game according to Steam are easily the most I've ever put into a game without actually playing it at all =p Haven't made it past Day One yet, between reading the manual, then reading for a few days about the game's mechanics, and just sitting in the Team Overview screen or exploring all the different screens—and now tweaking minor details like player handedness, cap hits, and histories. Probably not the best game for someone with OCD tendencies, but heck, it's been fun just learning how the game plays!

Having some trouble using the Editor to import a player's career history

Posted: Tue Feb 22, 2022 8:54 pm
by archibalduk
You're very close! IAs you say, if you want to import spreadsheets then you need to use a specific importer format via the templates. In the Editor click on File -> Import Spreadsheet -> Create Template and select an empty folder to save the templates. You will see that the Editor will have generated various spreadsheet templates. These are the templates which you can then populate and import into the Editor. It looks like you've already figured this bit out.

As you've identified per your screenshot C above, you need to complete the staff_history template and then import. The error shown in screenshot D shows "True" under the Staff Error column (column A). This means that the database you are importing into doesn't have a Craig Ludwig with the 15.3.1961 DOB. This is either because the player doesn't exist in the database or there is a typo in the name or DOB. You just need to either (i) add the player to the DB or (ii) correct this error in your spreadsheet in screenshot C and then it should import ok.
affablePeafowl wrote: Tue Feb 22, 2022 9:39 amApropos of nothing, the 28.6 hours I've logged on this game according to Steam are easily the most I've ever put into a game without actually playing it at all =p Haven't made it past Day One yet, between reading the manual, then reading for a few days about the game's mechanics, and just sitting in the Team Overview screen or exploring all the different screens—and now tweaking minor details like player handedness, cap hits, and histories. Probably not the best game for someone with OCD tendencies, but heck, it's been fun just learning how the game plays!
Welcome to our world! You're definitely not alone on this! :-D

Having some trouble using the Editor to import a player's career history

Posted: Wed Feb 23, 2022 4:44 am
by affablePeafowl
archibalduk wrote: Tue Feb 22, 2022 8:54 pm As you've identified per your screenshot C above, you need to complete the staff_history template and then import. The error shown in screenshot D shows "True" under the Staff Error column (column A). This means that the database you are importing into doesn't have a Craig Ludwig with the 15.3.1961 DOB. This is either because the player doesn't exist in the database or there is a typo in the name or DOB. You just need to either (i) add the player to the DB or (ii) correct this error in your spreadsheet in screenshot C and then it should import ok.
All's well that ends well! Double- and triple-checked that his name and birthday were correct and was stumped for a while. For a moment, I was legitimately asking myself "Is his name really Greg Ludwig, and I've mistakenly thought it was Craig for 25 years?" But I got it to work after I changed the filename to "staff_history", which I probably should've tried to begin with. Also noticed in the Import options that both date of birth boxes were unchecked (probably from me mindlessly clicking around through menus). I checked "full date of birth" so that might've been the issue too.

The only speedbump was that, at first, it imported all of the "playoff" fields as false, due to Excel's INFURIATING insistence on forcing boolean values where the importer is expecting strings. I have no idea why Excel's default setting is to assume you don't want to input the thing you're repeatedly trying to input, but whatever, it was a simple thing to fix. Loving the editor though, congratulations on writing a data editor for a niche hockey simulator that works better & more intuitively than a program actively developed over decades by a software company with a two-trillion-dollar market cap :-D

edit: D'oh, spoke too soon. It's saying all 29 rows are successfully imported, but then his history only shows 16 rows, all with a Playoffs value of "false" — except it's showing his playoff stats in the years where he did make the playoffs. It only shows his regular-season stats in seasons he didn't actually make the playoffs. It's as if it's importing all 29 rows, (16 regular seasons + 13 postseasons), but only displaying 16 because it doesn't want duplicated values in the "Year" fields. And in those cases, i.e. years he made the playoffs, it's "combining" both regular season/playoffs instances of the year by overwriting his regular-season stats with his playoff stats that year. It doesn't seem to matter whether the data type in the spreadsheet is boolean or text. I'm going to just manually set the 13 playoff seasons to "True" and re-import the remaining 16 regular seasons, minus the three non-playoff seasons which are already represented accurately, and see if that works.

edit 2: That worked! All of his career history is now accurate. I tried a hunch and deleted all the "false" values in the Playoffs fields in the 13 remaining seasons of data, since they were confusing Excel so much, and imported it with blank cells, thinking the Importer might read those as false. Success! To my surprise, it even re-ordered the History IDs in correct sequential order (n for his rookie season, n+1 for the playoffs that year, n+2 for his second season, etc.) For the handful of DAL guys without histories, it sounds like I might need to just use blank Playoffs cells for "false" since I'm just now realizing the Editor might be reading the presence of data and returning a True value. If that doesn't work, I can just upload regular season + playoffs separately, like I ended up doing with Ludwig.

Hockey-Reference lets you modify and export its tables very easily, It seems like it would be reasonably simple to write a Python utility that uses the csv module to mold Hockey-Reference spreadsheets/CSVs into the staff_history template, to be fed immediately into the Editor. Tempted to give that a try, although since there are only a couple of other DAL players without histories, that *might* be overkill, ha.

Having some trouble using the Editor to import a player's career history

Posted: Wed Feb 23, 2022 8:53 am
by archibalduk
affablePeafowl wrote: Wed Feb 23, 2022 4:44 amAlso noticed in the Import options that both date of birth boxes were unchecked (probably from me mindlessly clicking around through menus). I checked "full date of birth" so that might've been the issue too.
Ah yes this will have been the issue. I should add some logic to the Editor to stop you from being able to disable both. This determines how the Editor matches data from the spreadsheet against the database. "Full date of birth" should almost always be checked because it will ensure you're matching against the right person in the DB (e.g. it's fairly unlikely that there will be two people with the same name and same DOB). Generally "Year of Birth" should be unchecked unless you're working with players who have 1.2.1900 DOB set in the database (this denotes a random DOB based on the separate Year of Birth setting). If you disable both then the Editor doesn't have any source data to match against and that will explain why you were getting that error.

You don't have to call the filename staff_history. You can call it whatever you want. The text that identifies the type of file is actually inside the spreadsheet at Cell A1 (you'll see it says staff_history there).
affablePeafowl wrote: Wed Feb 23, 2022 4:44 amThe only speedbump was that, at first, it imported all of the "playoff" fields as false, due to Excel's INFURIATING insistence on forcing boolean values where the importer is expecting strings. I have no idea why Excel's default setting is to assume you don't want to input the thing you're repeatedly trying to input, but whatever, it was a simple thing to fix.
This is possibly because you exported the history from the player's screen in the Editor rather than via the separate Export Data screen. The one via the player's screen is in a slightly different format. If you want precisely the same format as the import format, go to File -> Export Spreadsheet (the button is to the right of the Import Spreadsheet button) and then export the player career history this way. Make sure you check the "Export as Research Spreadsheet" option as this ensures that the spreadsheet is in exactly the right format for re-importing (e.g. you'll see that the columns match up and there's "staff_history" at Cell A1).

The correct way of setting the Loan and Playoffs columns are to use Y or N for yes or no. A blank cell indicates "no".
affablePeafowl wrote: Wed Feb 23, 2022 4:44 amedit: D'oh, spoke too soon. It's saying all 29 rows are successfully imported, but then his history only shows 16 rows, all with a Playoffs value of "false" — except it's showing his playoff stats in the years where he did make the playoffs. It only shows his regular-season stats in seasons he didn't actually make the playoffs. It's as if it's importing all 29 rows, (16 regular seasons + 13 postseasons), but only displaying 16 because it doesn't want duplicated values in the "Year" fields. And in those cases, i.e. years he made the playoffs, it's "combining" both regular season/playoffs instances of the year by overwriting his regular-season stats with his playoff stats that year. It doesn't seem to matter whether the data type in the spreadsheet is boolean or text. I'm going to just manually set the 13 playoff seasons to "True" and re-import the remaining 16 regular seasons, minus the three non-playoff seasons which are already represented accurately, and see if that works.
The Editor doesn't allow you to enter duplicate history entries for a player. A duplicate is where the year, league, team and playoff/regular season are all the same. If they are duplicate then the Editor will edit the existing row of data using the data from your spreadsheet. So you could have multiple entries for a year provided that any of the League/Team/Playoff/Regular Season values are different.
affablePeafowl wrote: Wed Feb 23, 2022 4:44 amLoving the editor though, congratulations on writing a data editor for a niche hockey simulator that works better & more intuitively than a program actively developed over decades by a software company with a two-trillion-dollar market cap :-D
Thanks! I'm actually working on version 2 of the Editor at the moment. It's still in alpha and can only read (but not save) databases but it should be an improvement over Editor v1 once complete. There's a few issues with Editor v1 such as the fact that it's not as simple or user friendly as it could be and I'm hoping to fix these for Editor v2. I'll also be writing a proper manual for Editor v2. Your posts are really useful insight to see what is and isn't intuitive or obvious to somebody new to the Editor so that I can hopefully make things easier for Editor v2. So keep posting your questions and feedback. :-)

Having some trouble using the Editor to import a player's career history

Posted: Thu Feb 24, 2022 2:01 am
by affablePeafowl
archibalduk wrote: Wed Feb 23, 2022 8:53 am This is possibly because you exported the history from the player's screen in the Editor rather than via the separate Export Data screen. The one via the player's screen is in a slightly different format. If you want precisely the same format as the import format, go to File -> Export Spreadsheet (the button is to the right of the Import Spreadsheet button) and then export the player career history this way. Make sure you check the "Export as Research Spreadsheet" option as this ensures that the spreadsheet is in exactly the right format for re-importing (e.g. you'll see that the columns match up and there's "staff_history" at Cell A1).

The correct way of setting the Loan and Playoffs columns are to use Y or N for yes or no. A blank cell indicates "no".
Ah, makes perfect sense. Figured I had to be using the wrong format.

I've had a peek at the v2 thread, and it looks like it'll be a pretty sweet upgrade, but even v1 has been a pleasant surprise. I was expecting it'd take days to figure out, but even with this minor issue with player histories, I wasn't too far off the mark to start with. Editors in the past that I've used for games like NHL 2000 or NCAA Football 14 make the EHM Editor feel as simple and easy to use as Notepad.

I'm sure I'll have at least a couple of more questions at some point. I'm very good at creating obstacles for myself and overcomplicating things, so I'm a pretty good test subject for a project like this, ha. In the meantime, thanks for helping me out again!