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.
0
Comments
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.
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
regards
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 ]
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.
Dynamics Nav Add-ons
http://www.simplydynamics.ie/Addons.html