Running A Dataport Into A Codeunit
Moonspellheim
Member Posts: 8
Hi!Does anybody know how can I manage to run a dataport inside a codeunit without having to fill the form?For example,if I want to use a specific dataport inside a LOOP statement?
0
Comments
-
You need to call the dataport without request form (second param in DATAPORT.RUNMODAL) and add some function into dataport, which will set the FileName to apropriate value...
You need something like this in OnPreDataport trigger:CurrDataport.FILENAME(InputFile);
0 -
And how can I set a value in the Inputfile from the codeunit???
(If this question is too stupid,SORRY I am a beginner!!!
) 0 -
I do not know stupid questions, I know only stupid answers... :-)
Of course you can pass values in same way as into report etc. Define the dataport as variable, create some function in the dataport, call this function from the CU and pass the value, then call RUNMODAL on this dataport variable.
Or there is another way: define it as variable, this variable has property FILENAME - set it for the file name. Then run the dataport (DataPortVar is var of type Dataport and subtype your dataport you want to run):DataPortVar.FILENAME := 'my:\\filename.txt'; DataPortVar.IMPORT := true; //if you want import DataPortVar.RUNMODAL;
0 -
Hi again!
When I try the first way I get the message:"Dataport 0 does not exist".
When I try the second way I have to fill the form.
Do you have any idea what can I possibly be doing wrong???0 -
Moonspellheim wrote:When I try the first way I get the message:"Dataport 0 does not exist".
You didn't define which dataport you want to run... :-)
In second case, you need to disable Request Form (UseReqForm property on Dataport).0 -
You are so the man!!!I wish I was able to pay you back!!!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
- 323 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
