olliwest
16th April 2008, 16:32
Hello together,

i'm a beginner in developing tools for baan.
i like read a textfile and to compare with an argument, and if true do...
and if false do...

now have the textfile several lines, i tryed with:

while(ret = 0)
ret = seq.gets(stringline,500,seq.id)
if ret = 0 then
if stringline(1;7)="RUNNING" then
message("....")
break
|start.status_ok()
else
message("...")
break
|start.status_off()
endif
endif
endwhile

i need the information in thr 5. line of the text file, it works only in the first.

can everbody help me??

;-)

rduncan10
16th April 2008, 18:13
I think the "BREAK" statements might be breaking the WHILE loop. You don't need to use BREAK between IF and ENDIF.

By the way, you can simplify the code somewhat if you replace the first three lines with:
while not seq.gets(stringline,500,seq.id)

And take out one of the "endifs" before "endwhile".

Rob

pvandyk
22nd April 2008, 00:53
Correct, the "break" statements are doing exactly that: breaking you out of the while loop. A "break" is used when you want to exit an iteration loop early. As a generalization, this means you rarely use it in For and While loops but almost always use it with Case Statements.
Thank you,
pvandyk

olliwest
22nd April 2008, 09:42
thanks... :)