Announcement

Collapse
No announcement yet.

Array of UDTs + ERROR - Relational operator expected

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Array of UDTs + ERROR - Relational operator expected

    I am trying to have an array of UDTs. Any ideas as to why this is causing a compile error (Relational operator expected) ?

    Code:
     SUB LOAD_GL_EVENT_CODES_ARRAY_DATA(INDEX AS LONG, ONE_ROW AS STRING)
    
       GL_EVENT_CODES_ARRAY_DATA(INDEX).Task_Code           = PARSE$(ONE_ROW, ",", 1)
       GL_EVENT_CODES_ARRAY_DATA(INDEX).Task_Name           = PARSE$(ONE_ROW, ",", 2)
       GL_EVENT_CODES_ARRAY_DATA(INDEX).Event_Code          = PARSE$(ONE_ROW, ",", 3)
       GL_EVENT_CODES_ARRAY_DATA(INDEX).Event_Name          = PARSE$(ONE_ROW, ",", 4)
       GL_EVENT_CODES_ARRAY_DATA(INDEX).Message_Type_ID     = PARSE$(ONE_ROW, ",", 5)
       GL_EVENT_CODES_ARRAY_DATA(INDEX).Message_Type_Type   = PARSE$(ONE_ROW, ",", 6)
       GL_EVENT_CODES_ARRAY_DATA(INDEX).Additional_Fields   = PARSE$(ONE_ROW, ",", 7) + "," + PARSE$(ONE_ROW, ",", 8) + "," + PARSE$(ONE_ROW, ",", 9)
    
    ' DECLARED AT THE BEGINNING OF THE PROGRAM
    '
    '   TYPE EVENT_CODES_UDT
    '    Task_Code          AS LONG
    '    Task_Name          AS STRING * 30
    '    Event_Code         AS LONG
    '    Event_Name         AS STRING * 80
    '    Message_Type_ID    AS LONG
    '    Message_Type_Type  AS STRING * 50
    '    Additional_Fields  AS STRING * 100
    '   END TYPE
    '
    '   GLOBAL GL_EVENT_CODES_ARRAY_DATA() AS EVENT_CODES_UDT
    
     END SUB

  • #2
    GL_EVENT_CODES_ARRAY_DATA(Index).Task_Code is a long, you're setting it with a string

    try "= val(parse$(blah))"

    there are other UTD members that are LONG not STRING as well

    Cheers,
    Dale

    Comment


    • #3
      D'oh! You are right Dale!

      Comment


      • #4
        The first thing that strikes me is:
        GL_EVENT_CODES_ARRAY_DATA(INDEX).Task_Code = PARSE$(ONE_ROW, ",", 1) will return a String, but Task_Code is a Long. Try VAL(Parse$(ONE_ROW,",",1))) etc

        Comment

        Working...
        X