Passing Parameter when calling a data port from code unit.

Dev1978
Member Posts: 18
Hi guys.
I am calling a data port which will export the data to the text file. The data port is based on item table.
file_to_export := 'c:\text.txt';
DataportObject.FILENAME(file_to_export);
DataportObject.RUN;
I want to put the filter to export the data for a particular item code. That the user selected. Like i put the button on item card form "EXPORT DATA" i will call this data port and pass the current item code number from item card from.
I am calling a data port which will export the data to the text file. The data port is based on item table.
file_to_export := 'c:\text.txt';
DataportObject.FILENAME(file_to_export);
DataportObject.RUN;
I want to put the filter to export the data for a particular item code. That the user selected. Like i put the button on item card form "EXPORT DATA" i will call this data port and pass the current item code number from item card from.
0
Comments
-
Create a function in the dataport with the parameters you need to pass, then call the dataport function from your codeunit.David Machanick
http://mibuso.com/blogs/davidmachanick/0 -
Thanks for the reply. I have checked but still its not working fine.
Code for the function in Data Port.
Item.SETRANGE("No.",'%1',var1);
Code in code unit.
val:='9789957086855';
DataportObject.func1(val);
DataportObject.RUNMODAL();
MESSAGE('finish');
But still it is exporting all the records can you please tell me where i am doing wrong. Thanks0 -
Dev1978 wrote:Item.SETRANGE("No.",'%1',var1);
BTW, this is not the syntax of SETRANGE0 -
the syntax is like this for setrange
Item.SETRANGE("No.",var1);
even i tried
Item.SETRANGE("No.",'112233');
please correct me to get it worked.0 -
OnPush-trigger
CLEAR(ItemExp); CurrForm.SETSELECTIONFILTER(Rec); ItemExp.SETTABLEVIEW(Rec); ItemExp.FILENAME('C:\test1.txt'); ItemExp.RUNMODAL;
Set use Request Form to No and Import to No in Dataport properties.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