what i was actually trying to do is import data from a textfile into a table using a dataport. what is happening is that when i run the dataport it just freezes. the status bar doesnt move at all. i even left it over an hour and i just came to meet it like it was before. I need URGENT HELP!!!!! ](*,)
0
Comments
I think we need some more information about the dataport, to give help.
Have you tried debugging the dataport?
How big is the text file?
Is it an empty table before the import?
Do you do Autoinsert or a Manual insert?
Wat are the DataItem separators?
Are there any strange characters in the import file?
Is there a header in the importfile? Have you tried skipping it?
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
this character appears at the end of every record.there is no header in the import file.
kine asked
Did you define the dataport fields??
where do i have to define the dataport fields?
the fields in the table am trying to import are 14 and the table is empty before import.
field separator is "," and i tried the dataport without field start and end delimiters but non of them worked out.
dataitem separators are <<NewLine><NewLine>>
i've also tried to write a codeunit to do the import by using the selectstr function but what happens is it writes to the nav. table for a while and throws an error. I've also managed to import the data into sql server so if possible i would like to know also how to import data from sql server to navision database.[/code]
I had this once to.
Search this forum for info about reading from sql to Navision. Loads of info.
If you are designing your dataport and click "View - Dataport Fields". Have you defined some "fields" there (there can be variables too)?
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
For example: I ended up using Navision FILE datatype. Here is some information to give you at least a head-start on this method. I suggest taking a very small sample file first, and get it working with that, before trying it on the full-size version.
VARIABLES:
FileID --> Variable with DataType = File
BinaryLine --> DataType = Binary
CODE:
FileID.WRITEMODE(FALSE);
FileID.TEXTMODE(FALSE); (lets you read non-ascii "funny" characters)
FileID.OPEN(FileName);
...
...
Bytes := FileID.READ(BinaryLine);
ByteCount += Bytes;
WHILE Bytes > 0 then
BEGIN
Do whatever you need to do here, depending on the nature of your data.
What I did is to transfer, one character at a time, the data from the
BinaryLine into a TextLine, as follows.
TextLine[ImportStrCurrChar] := BinaryLine
Of course, there is a bunch of other logic I had to include to compress
spaces, ensure I don't overrun array boundaries, parse data properly,
and so on.
END;