How to run a dataport & an exe file thru a command button?
Aravindh_Navision
Member Posts: 258
Hi Friends,
My requirement: By clicking a new command button in Posted Invoice form, I must run a dataport followed by running an exe file.
I did a code in dataport (Dataport - OnPreDataport trigger) which stores the text file in specified folder ...
While running the dataport, it should filter to the current record and store in a specific folder. Then after few milliseconds the exe file should get triggered (which uses the extracted data through dataport from the folder - no need to worry about this function.).
Can anyone tell me how to achieve this?
Thanks,
Aravindh.
My requirement: By clicking a new command button in Posted Invoice form, I must run a dataport followed by running an exe file.
I did a code in dataport (Dataport - OnPreDataport trigger) which stores the text file in specified folder ...
CurrDataport.FILENAME := 'C:\ARG\EInvoice\' + FORMAT(WORKDATE,0, 'Invoice' + '.txt' ;... and I wrote in newly created command button's (On Push() trigger) ...
DATAPORT.RUN(DATAPORT::"<Name of the dataport to run>"); // To run a dataport
SHELL('C:\Program Files\Windows NT\Accessories\wordpad.exe'); // To run the exe file - just for an example
C:\Program Files\Windows NT\Accessories\wordpad.exe : is a sample path...While running the dataport, it should filter to the current record and store in a specific folder. Then after few milliseconds the exe file should get triggered (which uses the extracted data through dataport from the folder - no need to worry about this function.).
Can anyone tell me how to achieve this?
Thanks,
Aravindh.
0
Comments
-
Something like this:
recCurrentRecord.RESET; recCurrentRecord.SETCURRENTKEY("...."); recCurrentRecord.SETRANGE("key field 1","key field 1"); recCurrentRecord.SETRANGE("key field 2","key field 2"); DATAPORT.RUN(DATAPORT::"<Name of the dataport to run>",recCurrentRecord);Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
or better:
DATAPORT.RUN(DATAPORT::"<Name of the dataport to run>",FALSE,recCurrentRecord);
are you sure to use RUN not RUNMODAL... ?0 -
Anything is fine PWL.. I need a better approach to achieve this...

Aravindh.0 -
Either let the dataport inform NAV that it's done so you can start your exe, or test the folder for editable files and when found start the exe.
if you have a single instance codeunit, you can let the dataport modify a boolean in the cu so the exe can start. Or you can keep scanning the folder every few milliseconds for files that are editable. If found then you can run them.
Make sure that the code that's running waiting for the dataport to be finished won't lockup your NAV.0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions