Pulling my hair out over CSV import

OpenGD77CPS
Post Reply
kb7pst
Posts: 9
Joined: Fri Jun 09, 2023 4:08 pm

Pulling my hair out over CSV import

Post by kb7pst » Sat Jul 01, 2023 11:39 pm

I have been trying several days to get a set of analog and digital repeaters to import into the CPS using a CSV file. I exported my current codeplug and appended the new frequencies.

First difficulty -- it seems that the CPS wants the frequencies as a string with leading spaces and an exact number of zeros. Okay, some tinkering with Excel got me the file that's attached here.

When I go to upload this and the matching other files, I get this exception message:

Code: Select all

************** Exception Text **************
System.FormatException: Input string was not in a correct format.
   at System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt)
   at DMR.CSVEML.OpenChannelsCSV()
   at DMR.CSVEML.ReadCSVs(String PathName)
   at DMR.CSVEML.ImportCSVs(String CSVDirectory)
   at DMR.CSVEML.ImportCSV()
   at DMR.MainForm.tsbtnImportCSV_Click(Object sender, EventArgs e)
   at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Any ideas how I can fix this?
Attachments
Channels.csv
(81.72 KiB) Downloaded 74 times

VK3KYY
Posts: 7590
Joined: Sat Nov 16, 2019 3:25 am
Location: Melbourne, Australia

Re: Pulling my hair out over CSV import

Post by VK3KYY » Sun Jul 02, 2023 1:04 am

The CSV format that can be imported must be the same as it exports

Your format is totally different e.g.

The line that fails in your file is

Code: Select all

551,K7NWS Issaquah1,Analogue,"	145.33000","	144.73'",12.5,,,,,,,,179.9,179.9,Disabled,Master,No,No,No,90,Off,No,No
Whereas exporting a similar channel from my codeplug, looks like this

Code: Select all

12,VK3RSP A2,Analogue,	147.67500,	147.07500,25,,,,,,,,None,88.5,Disabled,Master,No,No,No,180,Off,No,No

The reason it crashed is becuase your Tx freq of 144.73 actually has an additional single quote mark (or apostrophe) at the end of it

The frequencies do not need to be wrapped in quotes

G4EML
Posts: 930
Joined: Sat Nov 16, 2019 10:01 am

Re: Pulling my hair out over CSV import

Post by G4EML » Sun Jul 02, 2023 1:20 am

You just beat me to it Roger!

I can confirm that channel 551 has an invalid Tx Frequency. Remove the extra ' and it will be OK.

There is no need to surround the numbers with quotes, but it doesn't do any harm. They must however only contain numeric characters or the conversion to frequencies will fail as it did here.

I will see if I can add some extra validation to the input routines to catch this type of error in the future.

Colin G4EML

kb7pst
Posts: 9
Joined: Fri Jun 09, 2023 4:08 pm

Re: Pulling my hair out over CSV import

Post by kb7pst » Sun Jul 02, 2023 1:21 am

And now... everything imports just fine.

:facepalm:

Thank you so very much for catching that!

VK3KYY
Posts: 7590
Joined: Sat Nov 16, 2019 3:25 am
Location: Melbourne, Australia

Re: Pulling my hair out over CSV import

Post by VK3KYY » Sun Jul 02, 2023 4:47 am

G4EML wrote:
Sun Jul 02, 2023 1:20 am

I will see if I can add some extra validation to the input routines to catch this type of error in the future.

Colin G4EML
We could catch the errors and list the line number, but I don't think we could put in an error message for every type of parse error, especially as all the messages need to be translated to all supported languages (eventually)

SA0BUX
Posts: 584
Joined: Tue Jul 05, 2022 8:50 am
Location: JO99ah, Stockholm, Sweden
Contact:

Re: Pulling my hair out over CSV import

Post by SA0BUX » Sun Jul 02, 2023 6:31 am

VK3KYY wrote:
Sun Jul 02, 2023 4:47 am
G4EML wrote:
Sun Jul 02, 2023 1:20 am

I will see if I can add some extra validation to the input routines to catch this type of error in the future.

Colin G4EML
We could catch the errors and list the line number, but I don't think we could put in an error message for every type of parse error, especially as all the messages need to be translated to all supported languages (eventually)
Yes line number where (first) parse error occurs would be useful !

Post Reply