How to add values to existing Text file in NAV ?

chandrurecchandrurec Member Posts: 560
Hi all,

I have created a text file named CustomerInfo.txt.

After this I want to add some more information to this text file in the second line.

Is this possible to append information to the already created text file in navision?

If possible, kindly send me the code snippet which will be used to achieve this

Thanks in advance.

Regards,
chandru.

Comments

  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    You'll have to reread the whole file. After reading a line, you can modify the variable containing the contents of the line and write that variable back to a new file CustomerInfo2.txt.
    After reading the whole file CustomerInfo.txt, and after writing all lines (with eventually modified data) to the new file CustomerInfo2.txt you can then delete CustomerInfo.txt and rename CustomerInfo2.txt to CustomerInfo.txt.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    try this
    CF := 10;
    fle.TEXTMODE := TRUE;
    fle.WRITEMODE := TRUE;
    fle.OPEN('C:\CustomerInfo.txt');
    fle.SEEK(fle.LEN);
    fle.WRITE(CF);
    fle.WRITE('2nd Line');
    fle.CLOSE;
    
  • jversusjjversusj Member Posts: 489
    Hi all,
    I am upgrading 3.7B to NAV2013.

    We have a number of processing reports that we used to either create or append to the end of an existing file (depending on whether the file exists at the time the report is run).

    In 2013 (Windows client), can i still do this, or do I have to further complicate it as Luc suggests, uploading the existing file, appending, and then downloading again?

    I have a lot of experience with this on our old version, but the 3 tier is messing with me!
    kind of fell into this...
  • jversusjjversusj Member Posts: 489
    this was actually easier than I was making it out to be. The network share where we keep the file in question needed to grant permissions to the service tier account. I was then able to open and append the file without either UPLOAD or DOWNLOAD requirements. More testing to follow, but it seems like I'm back on track. Thanks!
    kind of fell into this...
Sign In or Register to comment.