Filename Dataport

Red-Eagle
Member Posts: 107
I have a dataport (export) which i want to give the name of the purchase order it's exporting (Purchase Header."No."). Is this possible?
0
Answers
-
You can use the same technique you would use with a report:
SETRECFILTER; DATAPORT.RUN(DATAPORT::"My Export",ShowRequestForm,Rec);
orVAR MyExport : Dataport "My Export"; BEGIN dummyRec := Rec; dummyRec.SETRECFILTER; MyExport.SETTABLEVIEW(dummyRec); MyExport.RUN; END;
0 -
If you want to set the filename do a CurrDataport.FILENAME := YourOrder
If I remember right it needs to be in OnPreDataport.0 -
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.0 -
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.0
-
No i want to take the keyfield Purchase Header.No. as filename that will not be necessary a number what is following on the next one0
-
Are you still asking? or is this post solved?matttrax wrote: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';0 -
Okay now i do understand it. I will test it tomorrow. Thnx you for your help.0
-
Instead of
'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.Frank Dickschat
FD Consulting0 -
I tried it, but when i use this code:
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 filter0 -
Can anybody help me with this?0
-
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.0
-
Thnx you kapamarou. You solution worked perfect.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions