pralash
5th October 2017, 13:41
Hi,
I'm new to LN Programming.... I want to know how to read a record one by one from baan table and also how to store these records into the text files. Can anybody please give the sample script for this task...
Thanks in Advance,
Regards,
Pralash
mark_h
5th October 2017, 15:07
Look at the other post to see how to find a set of all the records I posted. Basically all you do is open a file select records, write them to the file. This is what I do in 4c4
|This opnes a temp file and I write a header record to it.
temp.itm = creat.tmp.file$(bse.tmp.dir$())
temp.itm = strip$(temp.itm)
output.itm = seq.open(temp.itm,"w")
buff = "SOURCE|DESCRIPTION|STATUS CODE|ITEM|ITEM TYPE|LONG DESC|INV. ORG|UOM|FIXED DAYS SUPPLY|FIXE LOT MULTIPLIER|"
& "FIXED ORDER QTY|MAX ORDER QTY|MIN. ORD QTY|PLANNER CODE|SHELF LIFE|POSTPROCESSING LEAD TIME|"
& "PREPROCESSING LEAD TIME|PROCESSING LEAD TIME|HEIGHT|LENGTH|WEIGHT|WIDTH|BUYER|INSPECTION|TEMPLATE|"
rc = seq.puts(buff, output.itm)
Inside the selectdo create a buffer - I use sprint but you could just concatenate string fields. So you can search sprint.
buff = sprintf$("WS|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s",
strip$(desc.item), org.csig, trim$(itemmaster.item), itemtype, "", pegorg, converted.uom, conv.ordi, conv.oqmf , conv.fioq, "", "",
make.planner, conv.shld, conv.post, conv.prep, conv.proc, conv.heig, conv.leng, conv.weig, conv.widt, strip$(tcudi005.psno), org.insp, itemtemplate)
rc = seq.puts(buff, output.itm)
and last I close the file and move it down to a client machine. Output dir is another form field - so user can tell me where the files go. You can search on each of the commands below.
rc = seq.flush(output.itm)
rc = seq.close(output.itm)
| Create temporary file to copy the PC file to
temp.file = output.dir & "WS_ITEMS_DATA_V10.txt"
rc = server2client(temp.itm, temp.file, 1)
rc = seq.unlink(temp.itm)
The best advice I can give is to try it yourself and debug what you write. Step thru command by command just to see what the coding does.
pralash
6th October 2017, 09:09
Thank a lot.... I try to implement the script by using your example...
Regards,
Pralash