Options

Delete Line in Textfile from Navision

TirtaTirta Member Posts: 53
Hi.

how do I delete a line in Textfile from Navision?

Did anyone know how to use f.trunc?

Thanks

Comments

  • Options
    jhoekjhoek Member Posts: 216
    As far as I know, you cannot delete a line from a text file without writing the file again, unless it's the last line, in which case you could read to the point just before the first line, and TRUNCate the file there.
    Kind regards,

    Jan Hoek
    Product Developer
    Mprise Products B.V.
  • Options
    TirtaTirta Member Posts: 53
    thanks jhoek for your express reply.

    Can you please tell me more detail about your statement:
    without writing the file again, unless it's the last line, in which case you could read to the point just before the first line, and TRUNCate the file there.

    I have to read a textfile and import it into Navision.
    e.g.
    95004969;10000;1100128;818,00;;0;;;;
    95004969;30000;1300176;16,00;;0;;;;
    95004969;20000;1230138;79,00;;0;;;;
    95004969;50000;1800367;124,00;;0;;;

    After read the first line, I want to delete the Line and then save it. The problem is how to delete....
  • Options
    jhoekjhoek Member Posts: 216
    As I mentioned earlier, you cannot easily delete the first line in a file. In your case, I think you will need to

    a. Read the first line;
    b. Create a temporary file;
    c. Write the second and following lines to the temporary file;
    d. Delete the original file;
    e. Rename the temporary file, so that it has the same name as the original file.

    Are you sure it won't be possible to achieve what you want to do differently? Why do you want to delete the lines one by one, and do you really need to start with the first one?
    Kind regards,

    Jan Hoek
    Product Developer
    Mprise Products B.V.
Sign In or Register to comment.