DATAPORT IMPORT OF FIXED LENGTH RECORD (1024 chars) TEXT FIELD POSITIONS ARE SHIFTED

DATAPORT IMPORT OF FIXED LENGTH RECORD (1024 chars) TEXT FIELD POSITIONS ARE SHIFTED IF LEADING SPACES My goal is to import a text field and then to use COPYSTR to process sub-fields. As example : try to import a TEXT(10) field DATA TO IMPORT : 1234567890 (no space - result is ok) —456---- (3 leading spaces and 4 trailing spaces - result value 456 is in position 1-3) Dataport Field Trigger -OnBeforeEvaluate - Text variable is wrong (leading spaces are suppressed and length is 3) Is it possible to use the format property to import leading spaces ? Alternate Dataport solutions ? Suppose positions 4 to 6 is a quantity… TIA Louis

Louis, There is no way that I know of to bring in the leading spaces in your example. I tried bringing in the first characters as a code fiele, etc., but had no luck. If you think that the first three import characters may/may not have spaces, then I would import the first three characters in a seperate variable. That way, you know what you will get for the 4th through 10th characters. Good Luck, Jack

Thank you Jack But I need to process multiple record types with variable field positions depending of the record type… Louis

You can create a dataport that import to var. Text 250 .Then reprocess it. p.ex. OnAfterImportRecord() TXT := DELCHR(TXT,’=’,’ '); IF TXT <> ‘’ THEN EVALUATE(Importe,TXT) ELSE Importe := 0;

Sorry but it is too late… I do it that way and that is the problem Step 1 Import into TXT (‘system’ var) BUT immediately, TXT contains 456 without MY leading spaces So, for Navision, FIXED format for text250 = VARIABLE format because POS 1-2-3 contains the original positions 4-5-6. Thank you for reply Agustin Louis

You are confusing reading the bytes from the file and showing these as text. The Dataport will have read 10 characters, but leading and trailing spaces are always stripped off when converting the data to a text variable. Even when you would have read the bytes by other means in a text variable/field, the spaces will be gone. Try to enter leading or trailing spaces in a textfield to see the same effect. Nevertheless, the non-space characters are all saved. John

Exactly John. It’s a shame. Epilogue : I use file functions to process such file. With DataPort available properties, it’s impossible to process Fixed format file with multiple record types (layout). Thanks to all.