Hi,
I have issue on import csv into server. After success import a file but when read inside detail is repeat last line. Example I have 6 lines record, when prompt a message to show a data it is show 7 record which is last record is repeat. Please advise. Thanks.
I have issue on import csv into server. After success import a file but when read inside detail is repeat last line. Example I have 6 lines record, when prompt a message to show a data it is show 7 record which is last record is repeat. Please advise. Thanks.
Code:
filename2 = "${BSE}/tmp_import/Upload_Engineering_Items.csv"
if get.ui.mode() = 1 then
ret2 = client2server("", filename2, false, false,true)
else
ret2 = client.upload.file(filename2)
endif
if ret2 <> 0 then | Cancel Upload data
stop()
else
temp.txt = trim$(get.local.filename())
str.no = len(temp.txt)
for i = 1 to str.no
instr = temp.txt(i;1)
if instr = "\" then
pos.1 = i
endif
endfor
filename = temp.txt(pos.1+1)
input.fp = seq.open(strip$(filename2),"rt")
if input.fp < 1 then
message("File Cannot be uploaded.")
return
else
seq.rewind(input.fp)
ret1 = seq.gets(curr.line, 2048, input.fp)
while ret1 = 0
ret1 = seq.gets(curr.line, 2048, input.fp)
message("Curr %s", curr.line) //here show 7 record which is last data is repeated
check1 = string.scan(curr.line, "%s,%s,%d,%s,%s,%d", itemcode, rev, line, type, component, qty)
if check1 <> 6 then
message("Invalid Fields.\n\nPlease check your field in your upload file.")
stop()
endif