I want to get automatically the filename at predefinitioned place for example C:\Temp
where the filename is for example IO07650.txt. The next purchase order will be then IO07651.txt.
If you want to determine the next file name based on pre-existing files you need to create a record variable of subtype File. You can then find the last record in the folder and go from there.
If you want to set the filename do a CurrDataport.FILENAME := YourOrder
If I remember right it needs to be in OnPreDataport.
He means YourOrder can equal
'c:\temp\'+PurchaseHeader."No."+'.txt';
I like the Date & time myself..
SavedFileName := FORMAT(WORKDATE,0,'<Year4>'+'-'+'<Month Text,3>'+'-'+'<Day,2>'+'-'+DELCHR((FORMAT(TIME)),'=',':'))+'.txt';
What Dataitem does the dataport run on and where did you write your code? It seems as if the system haven't found the Purchase line when you set the finename. So either you need some SETRANGE and FIND (If Purchase Line is not the Dataitem) or you need to move your code to another trigger.
Answers
or
If I remember right it needs to be in OnPreDataport.
My Blog - nav.education
where the filename is for example IO07650.txt. The next purchase order will be then IO07651.txt.
My Blog - nav.education
He means YourOrder can equal
'c:\temp\'+PurchaseHeader."No."+'.txt';
I like the Date & time myself..
SavedFileName := FORMAT(WORKDATE,0,'<Year4>'+'-'+'<Month Text,3>'+'-'+'<Day,2>'+'-'+DELCHR((FORMAT(TIME)),'=',':'))+'.txt';
http://www.BiloBeauty.com
http://www.autismspeaks.org
'c:\temp\'+PurchaseHeader."No."+'.txt';
you might try
ENVIRON('TEMP') + PurchaseHeader."No." + '.txt';
This gives you a temp path where the logged in user definitely has write permissions and it exists on all windows versions.
FD Consulting
CurrDataport.FILENAME := 'C:\' + "Purchase Line"."Document No." + '.txt';
I get
C:\.txt
I think the problem is that it need to get the value of the "document no." from the requestform which you set in the filter
Try "Purchase Line".GETFILTER("Document No.");