Dataports

I am working with a datport that needs to read a fixed length file with multiple types of records. I only need to use 1 of the types to update my table. I use a currdataport.skip to bypass the records that I do need. If one of the record has data that does not match the field datatype I get an error even though this record should be skipped. I could read it in as a string which would solve my problem, but I haven’t found a well to convert a string to a decimal,number,date etc. Does Navision have a conversion function?

EVALUATE serves this purpose. Use the triggers on the specifc dataport fields that you need to check. Saludos Nils

Check the EVALUATE function. Or perhaps some code in the OnBeforeImport() Trigger can be used to skip unwanted records.

Or open the file specified by CurrDataPort.Filename in OnPreDataport and read it with repeat… until pos = MyFile.LEN. For each iteration You do MyFile.READ(MyVariable) and then You do whatever You want with the data in MyVariable. This gives You a lot more control over what’s happening compared to using the dataport functionality. At least in my opinion. I only use dataports for on-time-imports to empty tables.