Switch to desktop version  
Quote too long error trying to read from a csv file - Printable Version

+- Ewon Technical Forum (https://techforum.ewon.biz)
+-- Forum: Development (https://techforum.ewon.biz/forum-50.html)
+--- Forum: BASIC Script (https://techforum.ewon.biz/forum-52.html)
+--- Thread: Quote too long error trying to read from a csv file (/thread-2573.html)



Quote too long error trying to read from a csv file - Johnn8978 - 23-09-2024

Hey,

I am trying to understand a error code who's now keep appearing every time the function is running.

This function is used to return a message related to an error code.
error code, semi column, message : 123;Message
Code:
FUNCTION GetStatus_CSV($fileString$,$integerValue%,@$statusString$)
// $fileString$: The name of the CSV file to read.
// $integerValue%: The fault code to search for.
// @$statusString$: A string that will hold the result (status) found in the file.


This line of code is the one to give "Quote too long(23)"
$Aint% = VAL $Astring$

Part of the code:

Code:
$ReadNextCode:
IF EOF 1 THEN GOTO $ReadDone
$Achar$ = GET 1,1
IF(($Achar$<>CHR$ 10) AND ($Achar$<>CHR$ 13) AND ($Achar$<>CHR$ 44) AND ($Achar$<>CHR$ 59)) THEN
$Astring$ = $Astring$ + $Achar$
GOTO $ReadNextCode
ELSE
IF($Astring$ = "") THEN GOTO $ReadNextCode
$Aint% = VAL $Astring$
$Astring$ = ""

It worked fine at first, but not anymore...and I can't figure out what's causing this situation.

I have a limited knowledge of Basic, so any help would be appreciated.

Thank you,


RE: Quote too long error trying to read from a csv file - simon - 23-09-2024

Hi,

Indeed like this, difficult to know what is happening.
I do not see any problem in your script.
Quote too long is normally triggered when you forget a quote when defining a string value.


RE: Quote too long error trying to read from a csv file - Johnn8978 - 23-09-2024

Actually, I found that the issue was not related to the code but from the updated csv file.

This structure was the one thatĀ gave the error.
   

This structure was the original, which does not have the semi-column, but uses two columns instead.
   

This is confusing because I had beenĀ told to use semi-column...

But it is working now.


RE: Quote too long error trying to read from a csv file - simon - 27-09-2024

Excellent :-) Happy that it works now.
Thx for the feedback !