Can someone tell me how to use f.seek in a dataport to skip the first 3 lines in the text file. f.seek needs a position(Integer), but I don’t know what number to give it. Simon
Believe you’re on the wrong track. The dataport reads the file and searches for the item separator, and for the record separator, to fill the fields. The f.seek command is used to move the pointer within the file to the indicated position, from where the next f.read will take place. The file commands/functions have nothing to do with dataports. Is there any specific character(pattern) that you could use to recognise the first lines in your import file? Then you could use these as data-item separator (default is twice) and read the first lines into a dummy data-item. Or make use of the OnBeforeImport trigger to examine the data read and reject the data coming from the first lines. John
There are ways to skip a few lines in a Dataport. Basically, you can intercept the incoming text (in a trigger called, if I remember correctly, OnBeforeImportText() or something like that) and do a DataPort.SKIP command if the line needs to be skipped. However, you really should only use Dataports for data import when you definitely know that every line contains data which fits into your table(s). When you need to ignore certain lines, change data in certain lines, etc., you really really really ought to use a nonprinting report instead. The batch job’s DataItem(s), BTW should be linked to the Integer table. The input and/or output tables should be accessed as record variables. Generally speaking, you should only use Dataports in two situations: 1. For one-off quick and dirty imports such as initializing tables while building a new database. 2. For exporting data from one Navision database to another (e.g., when importing tax data from the Navision web site.) I might add, that Dataports vs. Nonprinting Reports issue is one of the reasons I am currently between jobs. I had a supervisor )(not certified as a Solution Developer) who kinda knew how to write Dataports but had not a clue how to write write Nonprinting Reports. And one day, a discussion about this issue drifted onto other issues, and afterwards I decided to quit… but I digress… ------- Tim Horrigan