Stop adding rows based on what the row text contains

Home Forums Problems and solutions in GDL Object design Stop adding rows based on what the row text contains

This topic contains 1 reply, has 2 voices, and was last updated by  Péter Baksa 1 month, 1 week ago.

  • Author
    Posts
  • #3994

    James Goode
    Participant

    I have a way of working this problem out. I just don’t know how to implement it.
    (I apologise for the amount of posts but this is very frustrating!!)
    All I need is the ability to stop counting the lines based on what one of the rows contains.
    Is there a function that will do what I want it to?

    The row that I don’t want to include starts with “EF_25” which is what I should be able to use to identify it but I just don’t know the line/s of script that will help me achieve it.

    DIM sarray[]
    var = ""
    ! file in the library, containing parameter data
    filename = "ProjectNotes.txt"
    ch1 = OPEN ("text", filename, "MODE=RO, LIBRARY")
    i = 1
    j = 1
    y=1
    sarray[x1] = ""
    for z = 1 to x1
        n = INPUT (ch1, y, 1, var)
            sarray[j] = var
            j = j + 1
             i = i + 1
          y=y+1
    next z
    CLOSE ch1
    ! parameter popup with strings read from the file
    VALUES "RefNote" sarray
    
    x1 = vardim1(sarray)

    Thank you.

  • #4001

    Péter Baksa
    Participant

    Hi,

    This will force the for loop to end:
    if strsub(var, 1, 5) = "EF_25" then z = x1

    Péter Baksa
    Software Engineer, Library Team
    GRAPHISOFT SE

You must be logged in to reply to this topic.