Importing and parsing a text file with more than 1000 chars

sresre Member Posts: 62
... per line.

Hi everyone,

I'm getting a little bit frustrated after reading many posts concerning this topic but not finding the right hint for my problem.

What I want to do is simply importing a text file to create comment lines out of the content (e.g. for items). The structure looks something like this:

"item no.";"comment"
"1234";"this is a comment line"
"5000";"Don't sell this item together with item no. 6000"

My problem is that a single line can have up to 3000 characters so I can't use a simple dataport. I know about big text, blob fields and streams but still I'm not able to find the right combination to do the job. E.g. when I try to put the content of one line from the file into a big text the system tells me I can't do that and I have to use text instead. I'm sure it's me and not NAV (at least in this situation) but I really need to make some progress now.

I know that there are many posts discussing these issues - well, more or less. But I haven't been able to find one addressing my problem or at least providing a hint to finally solve my problem. It's not about splitting up the text by determining the seperators. I don't even get this far as I'm not able to get the information from the file into a form in which I can do the actualy splitting and stuff.

Any help (even the link to the right thread in this or any other forum) would be highly appriciated.

Thanks in advance!
Sascha

Comments

  • SavatageSavatage Member Posts: 7,142
    we use this: Waldopad to save large amounts of text describing items.

    http://www.mibuso.com/dlinfo.asp?FileID=335
  • sresre Member Posts: 62
    Savatage wrote:
    we use this: Waldopad to save large amounts of text describing items.

    Thanks, Savatage. It's not exactly what I need to do as I'm migrating a lot of data from another system which is delivered in a text file. But on the other hand it could be a good idea to check how Waldo does it (but I guess "the magic" doesn't happen in the C/AL part of Waldopad) ... I'll give it a try.

    Any one else, please?
  • james_csjames_cs Member Posts: 39
    Hi Sre

    looks like you'll have to wave dataports goodbye. They are obsolete anyway...

    use a codeunit with a file data type and do something like this.


    Myfile.TEXTMODE(TRUE);
    Myfile.WRITEMODE(FALSE);
    Myfile.OPEN('C:\longtext.txt');
    MESSAGE('%1',Myfile.READ(MyBigText));

    then you can get the data out of the big text variable field by field and hopefully find it useful.

    Good luck!
  • SavatageSavatage Member Posts: 7,142
    NOTE: with waldo pad it saves the data into a table. Which you can import to with a report, dataport, Xmlport.
    Each line of data is 250 characters, so each item "extra info" can be saved on multiple lines.

    What the waldopad does is nicely cut it off at a "space" instead of in the middle of the word as COPYSTR would do. But you can import it into the table and deal with word cut offs later if you come across them.
Sign In or Register to comment.