• Data Type Error Argument 6 FWriteline

    From jrollo64@gmail.com@21:1/5 to All on Fri Dec 24 15:06:49 2021
    Hi I'm getting a "Function: _GET_LONG" error (Type String, requested type LONGINT)

    What am I missing please? Heres the code involved:

    For i := 1 to oDb:Fcount
    AAdd(aRay, {oDb:FieldInfo(DBS_NAME, i), oDb:FieldInfo(DBS_TYPE, i), oDb:FieldInfo(DBS_LEN, i), oDb:FieldInfo(DBS_DEC, i)})
    FWriteLine(ptrHandle, "AAdd(aDBF,{ " + '"' + AllTrim(oDb:FieldInfo(DBS_NAME, i)) + '", ' + '"' + AllTrim(oDb:FieldInfo(DBS_TYPE, i)) + '", ' + AllTrim(Str(oDb:FieldInfo(DBS_LEN, i))) + ', ' , AllTrim(Str(oDb:FieldInfo(DBS_DEC, i))))
    ? "AAdd(aDBF,{ " + '"' + AllTrim(oDb:FieldInfo(DBS_NAME, i)) + '", ' + '"' + AllTrim(oDb:FieldInfo(DBS_TYPE, i)) + '", ' + AllTrim(Str(oDb:FieldInfo(DBS_LEN, i))) + ', ' , AllTrim(Str(oDb:FieldInfo(DBS_DEC, i)))
    Next

    This line of code gives the error,

    FWriteLine(ptrHandle, "AAdd(aDBF,{ " + '"' + AllTrim(oDb:FieldInfo(DBS_NAME, i)) + '", ' + '"' + AllTrim(oDb:FieldInfo(DBS_TYPE, i)) + '", ' + AllTrim(Str(oDb:FieldInfo(DBS_LEN, i))) + ', ' , AllTrim(Str(oDb:FieldInfo(DBS_DEC, i))))


    While this line does not and works fine
    ? "AAdd(aDBF,{ " + '"' + AllTrim(oDb:FieldInfo(DBS_NAME, i)) + '", ' + '"' + AllTrim(oDb:FieldInfo(DBS_TYPE, i)) + '", ' + AllTrim(Str(oDb:FieldInfo(DBS_LEN, i))) + ', ' , AllTrim(Str(oDb:FieldInfo(DBS_DEC, i)))


    What am I missing please?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From D.J.W. van Kooten@21:1/5 to All on Sat Dec 25 01:44:54 2021
    Replying on message of Fri, 24 Dec 2021 15:06:49 -0800 (PST) from jrol...@gmail.com:


    Hello jrol...@gmail.com

    What am I missing please?


    Not an obvious one. I would first assign the line to a string variable
    and then see if FWriteLine(ptrHandle,cString) works. If not, replace
    the string with something simple.

    FWriteLine is not strong typed and you do not need to supply nCount as
    this will then take the length of the string. So a longint requested
    error doesn't directly make sense.

    Maybe something is wrong with the string due to the construction with
    single and double quots and this should become clear by assigning to a
    string variable (and then add to it part by part)

    Dick

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From jrollo64@gmail.com@21:1/5 to D.J.W. van Kooten on Sun Dec 26 17:30:31 2021
    On Saturday, 25 December 2021 at 11:44:55 UTC+11, D.J.W. van Kooten wrote:
    Replying on message of Fri, 24 Dec 2021 15:06:49 -0800 (PST) from jrol...@gmail.com:


    Hello jrol...@gmail.com
    What am I missing please?
    Not an obvious one. I would first assign the line to a string variable
    and then see if FWriteLine(ptrHandle,cString) works. If not, replace
    the string with something simple.

    FWriteLine is not strong typed and you do not need to supply nCount as
    this will then take the length of the string. So a longint requested
    error doesn't directly make sense.

    Maybe something is wrong with the string due to the construction with
    single and double quots and this should become clear by assigning to a
    string variable (and then add to it part by part)

    Dick
    Thank you very much Dick, you were correct, assigning the string to a variable solved it. Thank you again

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Steve@21:1/5 to jrol...@gmail.com on Mon Dec 27 02:08:07 2021
    On Friday, December 24, 2021 at 11:06:50 PM UTC, jrol...@gmail.com wrote:
    Hi I'm getting a "Function: _GET_LONG" error (Type String, requested type LONGINT)

    What am I missing please? Heres the code involved:

    For i := 1 to oDb:Fcount
    AAdd(aRay, {oDb:FieldInfo(DBS_NAME, i), oDb:FieldInfo(DBS_TYPE, i), oDb:FieldInfo(DBS_LEN, i), oDb:FieldInfo(DBS_DEC, i)})
    FWriteLine(ptrHandle, "AAdd(aDBF,{ " + '"' + AllTrim(oDb:FieldInfo(DBS_NAME, i)) + '", ' + '"' + AllTrim(oDb:FieldInfo(DBS_TYPE, i)) + '", ' + AllTrim(Str(oDb:FieldInfo(DBS_LEN, i))) + ', ' , AllTrim(Str(oDb:FieldInfo(DBS_DEC, i))))
    ? "AAdd(aDBF,{ " + '"' + AllTrim(oDb:FieldInfo(DBS_NAME, i)) + '", ' + '"' + AllTrim(oDb:FieldInfo(DBS_TYPE, i)) + '", ' + AllTrim(Str(oDb:FieldInfo(DBS_LEN, i))) + ', ' , AllTrim(Str(oDb:FieldInfo(DBS_DEC, i)))
    Next

    This line of code gives the error,

    FWriteLine(ptrHandle, "AAdd(aDBF,{ " + '"' + AllTrim(oDb:FieldInfo(DBS_NAME, i)) + '", ' + '"' + AllTrim(oDb:FieldInfo(DBS_TYPE, i)) + '", ' + AllTrim(Str(oDb:FieldInfo(DBS_LEN, i))) + ', ' , AllTrim(Str(oDb:FieldInfo(DBS_DEC, i))))


    While this line does not and works fine
    ? "AAdd(aDBF,{ " + '"' + AllTrim(oDb:FieldInfo(DBS_NAME, i)) + '", ' + '"' + AllTrim(oDb:FieldInfo(DBS_TYPE, i)) + '", ' + AllTrim(Str(oDb:FieldInfo(DBS_LEN, i))) + ', ' , AllTrim(Str(oDb:FieldInfo(DBS_DEC, i)))


    What am I missing please?
    It's the last part of the line that is wrong, + ', ' , AllTrim(Str(oDb:FieldInfo(DBS_DEC, i))). I think the final , (comma) should be a + (plus sign), or the final ' (apostrophy) should be at the end of the line. If you break the line down you will see
    what I mean
    "AAdd(aDBF,{ "
    +
    '"'
    +
    AllTrim(oDb:FieldInfo(DBS_NAME, i))
    +
    '", '
    +
    '"'
    +
    AllTrim(oDb:FieldInfo(DBS_TYPE, i))
    +
    '", '
    +
    AllTrim(Str(oDb:FieldInfo(DBS_LEN, i)))
    + ', ' , AllTrim(Str(oDb:FieldInfo(DBS_DEC, i)))

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)