As per attached file is there any way to import this file into NAV tables by using stream.
*This post is locked for comments
Dear Binesh,
Thanks for help.
Regards,
Sandeep
Hello,
Write some logic, something like:
LOCAL ReadFile()
MyFile.OPEN('c:\Temp\File1.txt');
MyFile.CREATEINSTREAM(StreamInTest);
WHILE NOT StreamInTest.EOS DO BEGIN
StreamInTest.READTEXT(Buffer);
//MESSAGE('%1',Buffer);
j:= 1;
FOR i := 1 TO STRLEN(Buffer) DO BEGIN
IF (Buffer[i] = '|') THEN BEGIN
CLEAR(CurrCellData);
CLEAR(k);
CLEAR(K_To);
CLEAR(L);
K_To := i;
FOR k := j TO K_To-1 DO BEGIN
L += 1;
CurrCellData[L] := Buffer[k];
END;
MESSAGE('CurrCellData: %1',CurrCellData); // Test your data, you will get field wise data
j := K_To + 1;
END;
END;
END;
// Here
i,j,k,L, K_To is a Integer type variable and CurrCellData is A text Type.
Based on your requirement you should write ur logic.
Dear Binesh,
Thanks for reply but after reading data into buffer table how we can map table columns if buffer has multiple rows.
Hello, You can read all lines in a file, see the bellow code:
//LOCAL ReadFile() ->
MyFile.OPEN('c:\Temp\File1.txt');
MyFile.CREATEINSTREAM(StreamInTest);
WHILE NOT StreamInTest.EOS DO BEGIN
StreamInTest.READTEXT(Buffer);
MESSAGE('%1',Buffer);
// here you can write your statements....
END;
//Local Variables:
Name DataType
MyFile File
StreamInTest InStream
Buffer Text
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,228 Super User 2024 Season 2
Martin Dráb 230,056 Most Valuable Professional
nmaenpaa 101,156