Write a codeunit which will create a text file by name customer.txt in C drive and write customer code and names in it
CLEAR(MyFile);
MyFile.TEXTMODE(TRUE);
MyFile.WRITEMODE(TRUE);
MyFile.CREATE(‘c:\MyNewFolder\Customer.txt’);
MyFile.WRITE(“No.”);
MyFile.CLOSE();
i have written this code but i am not customer nos in text file only getting text like field name No.
Go to properties of Codeunit and select Table no as 18
i changed in properties also but not getting
Actually i am getting no.of characters writing in text file but not able to write customer records in text file.
please help me
You need to get the Customer Record and loop through all the records
CLEAR(MyFile);
MyFile.TEXTMODE(TRUE);
MyFile.WRITEMODE(TRUE);
MyFile.CREATE(‘c:\Customer.txt’);
IF Cust.FINDSET THEN
REPEAT
MyFile.WRITE(Cust.“No.”);
UNTIL Cust.NEXT = 0;
MyFile.CLOSE();