Reading a Tab delimited file

Hi,

Is it possible to read in a Tab delimited text file within Navision?, I have given up with the dataports and am now reading the text file using a file variable type, the issue I am having is when I go through the file character by character, I need to test to see of the character is a tab?

Many Thanks

Hello May I ask why you gave up on dataport?

As for tab
chr is of type char
mystring is text

chr := 9;

chr := 9;

mystring := ‘hello’+format(chr)+‘hello’;

if mystring[ 6 ] = chr then
message(‘its a tab’);

//or

if copystr(mystring,6,1) = format(chr) then
message(‘its a tab’);

Yes it is possible to read the delimited file.

What was the problem with the dataport solution?

Yes it is possible to read tab delimited Text file and also you can read Tab delimited file using datraport as welll… just define the delimiter in the dataport properties…

Actually, it is better to use tab-delimited dataports than comma-seperated dataports. I have had numerous problems with the latter.
With tab-delimited dataports, I never had problems.
These are the properties you need to set:
FieldStartDelimiter and FieldEndDelimiter= (you can leave it default in case your text are surrounded by ")
FieldSeparator=

IMPORTANT : you need also to put the < and > in the properties AND you have to respect also the upper/lowercase (e.g. using does NOT work).

Actually…I find it even better to work with some other delimiter that is very unlikely to appear in data such as ; or ~. It is too easy to corrupt data with .

Moving data between countries in Europe means that , (comma) and . (point/period) are used for different purposes and can lead to confusion!

However, if you have to live with that can work too.

[:D]

Actually the ; or ~ appear quite often in the data. This because most keyboards have the sign on it and users use them (the ~ doesn’t appear on most Italian keyboards).
It is more difficult for users to put a in it.
Of course you can also use the “Sanskrit Separated Values file format” [:D] http://www.mibuso.com/forum/viewtopic.php?p=21883#21883

Kriki,

You are right. I was ‘stuck’ in the “we must transfer data between System X and Navision” or “we must transfer data from Navision to SAP” mind-set and had completely forgotten the wide range of data that users somehow manage to force into data fields.

However we should all be more disciplined when specifying the format of data for import / export so that we can make life a little easier.

Thanks also for the link - this was as sunny as to-day in Scotland.

[:D][:D]

Follow the advise of KRIKI.
You can import almost any ASCII file format.

Fixed length, Comma, Tab, ~, #, etc.

Go to dataport property and change: FieldSeparator=

Navision help on this field says this: Just remember its CASE sensitive.[6]

FieldSeparator

Use this property to define the string that is to be used to separate fields.

Applies to

Dataports

Settings

The FieldSeparator settings are:



This string…



Means…

that there will no be FieldSeparator
any combination of CR and LF characters
<CR/LF> CR followed by LF
CR alone
LF alone
Tabulator alone
Other strings the literal string entered

The strings in the table above must be entered literally, that is: the < and > characters must be entered. These special strings can be combined and can also be mixed with other characters.

The default is , (a comma).

CR refers to the character with ASCII value 13

LF refers to the character with ASCII value 10