Other SOTA sites: SOTAwatch | SOTA Home | Database | Video | Photos | Shop | Mapping | FAQs | Facebook | Contact SOTA

Error on .csv import


#1

error- properly formatted .csv
any ideas?

----->>>>

			An error has occured whilst processing line 1 of the input file.

Please ensure the input file is valid CSV or TSV.
System.IndexOutOfRangeException:
Index was outside the bounds of the array.
at SOTA.AddActivatorEntry.getActivatorCSVLine(StreamReader sr,
SqlConnection dbConnection, Int32 userId, DateTime& lastDate,
String& lastTime, Int32& summitID, Boolean& parseErrorFlag,
Boolean& parseDuplicateFlag, Boolean& Datewrap, Boolean&
EatFirstLine, Boolean& S2S, Boolean& Chaser) in
C:\SOTA\SOTADATABASE\AddActivatorEntry.cs:line 556
at SOTA.ActivatorCSV2.Page_Load(Object sender, EventArgs e) in
C:\SOTA\SOTADATABASE\ActivatorCSV2.aspx.cs:line 78


#2

Somebody’s slip is showing…


#3

:blush:


OK the bug was one I though was fixed sometime back but obviously not. :frowning:

Clifford, here is the 1st line of one of the attempts you made (I have removed the extra semicolons).

v2,KK6QMS,W6/CT-207,30/03/2015,02:00,144MHz,FM,KB6WWI,Anthony the manthony in Reseda,1,0

The “,1,0” at the end of the line is causing the issue. Remove it and it should work. Well it worked for me.

v2,KK6QMS,W6/CT-207,30/03/2015,02:00,144MHz,FM,KB6WWI,Anthony the manthony in Reseda,


#4

Thanks. Same error. Honestly does not seem like it is even uploading it before the error appears. Pretty much instant. Tried different browsers.

before edit:


after edit:

------------->

An error has occured whilst processing line 1 of the input file.
Please ensure the input file is valid CSV or TSV.
System.ApplicationException:
Invalid Line Length
at SOTA.AddActivatorEntry.getActivatorCSVLine(StreamReader sr,
SqlConnection dbConnection, Int32 userId, DateTime& lastDate,
String& lastTime, Int32& summitID, Boolean& parseErrorFlag,
Boolean& parseDuplicateFlag, Boolean& Datewrap, Boolean&
EatFirstLine, Boolean& S2S, Boolean& Chaser) in
C:\SOTA\SOTADATABASE\AddActivatorEntry.cs:line 441
at SOTA.ActivatorCSV2.Page_Load(Object sender, EventArgs e) in
C:\SOTA\SOTADATABASE\ActivatorCSV2.aspx.cs:line 78


#5

Clifford,

From the screen shots - both before and after the edit - it looks like you have lots of unnecessary content.
Line one of the file should simply be:
v2,KK6QMS,W6/CT-207,30/03/2015,02:00,144MHz,FM,KB6WWI,Anthony the manthony in Reseda CR
Where CR represents a “Carriage Return”

All the “stuff” in the file before then is what I suspect is causing the problem. Then all the semicolon symbols will also be causing issues.
Andy will probably confirm or clarify my suspicions…

So it should look like the following in Notepad:
v2,KK6QMS,W6/CT-207,30/03/2015,02:00,144MHz,FM,KB6WWI,Anthony the manthony in Reseda CR
v2,KK6QMS,W6/CT-207,30/03/2015,02:00,144MHz,FM,AA4CD,Chris in Carlsbad CR
etc

Good luck,

Peter VK3PF


#6

I downloaded my logs from SOTA and used that as a template. Was too much trouble I just entered it manually. C


#7

Sometimes I have to ask why I bother.

I’ve found the regression which reintroduced a bug which one of Clifford’s mal-formed files was triggering. I’ve also added some enhanced debug messages for when the parser fails. I’ll push this to the server when I’ve done some more testing.


#8

Uh anyway, prior to manually entering the log and getting on with my day I tried clearing all the characters before the first entry, tried clearing all the characters between the first entry and the first 2 lines which looked unique etc, and nothing worked. I made the assumption that a .csv log generated from the SOTA database would be a worthy template to start with. Maybe OpenOffice introduced some garbage but like I said it seemed to me as though the error was occurring before the file was ever uploaded. I have no way of knowing. Thanks for the code edits I will certainly try it again next time.

Also if there are any Android apps that produce well formed .csv that I could use for logging during an activation I would appreciate the info. The ones I have tried are tedious and small and make logging a chore. Writing by hand is still the quickest way for me at this point.

Clifford


#9

That’s a good assumption. Something broke the files in OpeneOffice and then these broken files were able to make a bug reappear I thought I’d fixed. I use OpenOffice myself on Win7/Linux so it does normally work.

I have a better way of coping with bad data based on trying with your broken file but I want to do more testing before I release this.


#10

Clifford, not much help about your issue with csv but as an emergency help I have just used Notepad and saved the file as a txt and loaded that to the database … Unless Andy has broken that too. :wink:

Neil


#11

I managed to regress the parser so it would fail on files downloaded from the DB itself, a crowning achievement I think!

I have a version which now accepts files downloaded from itself so you can save S2S, Chaser, Activation logs, edit them and reimport. At the same time I’ve tidied the error reporting so the error message is more explicit. In Clifford’s case it now says the line is too long or too short. The other activation and chaser upload errors have been improved too.

I’m still testing. I did have a set of csv files with assorted bad lines and data that I had for exercising this code and one day I’ll find where I saved them in the 8TB of disks I have here. Until I’ve thrashed it more I’m not uploading it, but that time will be soon.


SOTA CSV Editor
#13

Clifford, there is an online CSV editor/generator in the SMP which you can use to create or edit CSV logs manually. Go to the SMP extras page, click on the “Create SOTA CSV” tab if it’s not already activated, and you can either load a CSV file and then edit it, or create a new file from scratch.

It’s designed to be user-friendly, can spot the worst kinds of errors in callsigns or SOTA summit entries and creates a SOTA standard CSV file ready for import into the SOTA database. If your browser or PC crashes during data-entry, the page picks up exactly where you left off before the crash. The page also converts ADIF files to CSV in much the same way.

Try it, it might be just what you’re looking for.

Rob


#14

Very cool, thanks!

Also many thanks to Andy for the DB work and everyone else who responded and assisted me with my questions.

I will try notepad and the SMP create csv- thanks

Clifford


#15

UPDATE- tried latest v1.3 of SOTA CSV log editor and does not work on import all blank and when trying the online log editor in the extras section get the following error:
“JSON parse error” SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data"
I have no luck with this at all!
C


#16

I have no idea what this is all about - I have just created a new activator log with my CSV Editor for today’s 3cm and 6m contests and the upload to the SOTA Database worked fine for me.


#17

I have explained my issue clearly and tested in different ways. The fact that it works fine for you does not offer much to me in the form of troubleshooting or advice.
C


#18

Sorry but it must be me failing to understand the full details of what you are doing.

I can only reproduce the JSON error when trying to upload a CSV generated by my SOTA CSV Editor (or one downloaded from the Database site) to the Mapping Site.

If you are creating a CSV using my SOTA CSV Program then each line should look similar to:

v2,G0LGS/P,,01/05/2015,13:02,144MHz,SSB,GW4TJC/P,GW/NW-040,Comment

These seem to work fine for upload to the Database site, but NOT to the Mapping site.

If you download from the current Database site you will find an extra Comma at the end of the line (that format should also work fine).

If you are using an older one from the database site you might have one or two extra values at the end (for Points and Bonus) - attempting to upload these versions used to cause issues with the site (it is sometime ago since I tried those versions).

Whilst my program should load these older versions it can only create or save logs in the newer format.

Stewart


#19

Upload to mapping site was only an afterthought. Blank on upload to DB the primary concern. The .csv I got from the CSV editor is below- I see no way to attach the actual .csv only images here.
thx
C

v2,KK6QMS,26/05/2015,01:35,144MHz,FM,KR6RG,W6/SC-337,kr6rg 5/11 635pm intl border
v2,KK6QMS,26/05/2015,01:38,144MHz,FM,KB6WWI,W6/SC-337,kb6wwi 638pm
v2,KK6QMS,26/05/2015,01:39,144MHz,FM,K6VGP,W6/SC-337,k6vgp 639pm 5/5
v2,KK6QMS,26/05/2015,01:40,144MHz,FM,KK6FUT,W6/SC-337,kk6fut Ben mobile 5/13
v2,KK6QMS,26/05/2015,01:42,144MHz,FM,KD6RCM,W6/SC-337,kd6rcm Todd w simi 5/13
v2,KK6QMS,26/05/2015,02:01,144MHz,FM,N6TZ,W6/SC-337,n6tz 5/13 HAL camarillo 701pm
v2,KK6QMS,26/05/2015,02:21,144MHz,FM,KC6UIH,W6/SC-337,kc6uih Mark thousand oaks -0 721pm (ft100d)
v2,KK6QMS,26/05/2015,02:51,144MHz,FM,KD6DSH,W6/SC-337,kd6dsh mike sbarbara 751pm
v2,KK6QMS,26/05/2015,02:56,144MHz,FM,W6KGB,W6/SC-337,w6kgb Matt 756pm


#20

A simple question, are you trying to upload an activation log or a chase log?

If you are trying to upload an activation then unfortunately you have produced a chaser log. If you upload that with the “Import Activation CSV/TSV” option you will get a lot of “Ignored” entries in the view, as previously explained.

Activation CSV files are explained on this page of the database: http://www.sotadata.org.uk/ActivatorCSVInfo.htm


#21

Stewart’s right that the SMP was having a problem here. I had blithely assumed that a date function I was using in PHP would automatically handle UK date formats - I was wrong! :frowning: Fixed this now.

Not that anybody’s going to use it, of course…

Rob