DATAPORT.RUN with function / Dynamic set dataport variable

raven44
Member Posts: 85
Firstly, I suspect this can't be done BUT I'm hanging on the slightest chance of hope.
My scenario is:
I have the Object Type (Eg. dataport - which will be used to import) and Object ID in a table.
I want to run this dataport but set the filename from eg. another field in that table.
"Integer Value (PK)","Object Type", "Object ID", "Filename"
Within the dataport is a function to set the filename - but how can this function be called when using:
DATAPORT.RUN("Object ID",FALSE);
The only other alternative is having the ability to dynamically set a dataport variable - is this even possible?
Any ideas?
Thanks in advance.
My scenario is:
I have the Object Type (Eg. dataport - which will be used to import) and Object ID in a table.
I want to run this dataport but set the filename from eg. another field in that table.
"Integer Value (PK)","Object Type", "Object ID", "Filename"
Within the dataport is a function to set the filename - but how can this function be called when using:
DATAPORT.RUN("Object ID",FALSE);
The only other alternative is having the ability to dynamically set a dataport variable - is this even possible?
Any ideas?
Thanks in advance.
0
Comments
-
Hi,
don't use DATAPORT.RUN, but declare the Dataport as a global or local variable. Then you can access the functions that are in the dataport to set the filename.0 -
You mean without declaring a separate variable for each dataport and without modifying all the dataports to set the filename?0
-
Sorry, with Dataport.run / runmodal you can not set the Filename (only Dataport - OnPreDataport() / Dataport - OnInitDataport()).
But if your filename is dynamic you can set the dataport as variable and use the function filename. But with this you must every dataport set as variable.
Or you store in your table where you also store the Dataport ID also the Dataportexport/ImportPath and in OnInitDataport() you read the rec and set the filename
regardsDo you make it right, it works too!0 -
I wouldn't be able to set the dataports as variables, as this would mean creating variables for many objects and if a new dataport got created - this would need to be set in the calling function. This is why I was wondering if we could dynamically set a dataport as a variable (during runtime.....somehow). We know the object type, we know the ID...but how to create a dynamic variable.
Your second option is closer to what I was thinking, but if the user selects the same dataport for different records (due to the Primary Key) - then we wouldn't know what filename to use.
Table Example:
PK Type ID Filename
1 Dataport 50000 C:\Cars
2 Dataport 50001 C:\Boats
3 Dataport 50000 C:\Cars (New Models)
[I know the 'simple' answer would be PK = Integer, Type and ID - then create a [i]new [/i]dataport for [b]each [/b]one but where's the fun in that]
0 -
Hi,
Why not let the user select the filename in the form ans store it to the table, then the dataport can read the table to get the filename. Another option is to use a single instance codeunit and set/retreive the filename from it.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