Hi, all! Can anybody give me an idea of how to get this work: Suppose we have a form, where user fills in some text fields and clicks “OK” to run a dataport. Is it possible to pass values of these fields to it? (without storing them in tables, of course) Is there a way to call dataport with parameters?
In brief: Create a function in the dataport to which You can pass Your parameters. In that function You should have code to store those parameters in global variables in the dataport. Then declare the dataport as a variable in You form. Call the dataports function and after that MyDataportVariable.RUN This is the same way as You can pass variables to reports. Look at “Suggest vendor payments” for an example. There You can see how the “Journal Template Name” and “Journal Batch Name” is set. Good luck! /Lars
Don’t gorget that if you are adding fields to the request form on a dataport to add a textbox for the filename (if not specified in dataport options). The TextBox must have a Control ID of 1 and you should set the AssitEdit property to Yes. Then, in the OnPreDataport trigger add CurrDataport.FILENAME := FileNameVar; Where FileNameVar is the global set as the sourceexpression in your textbox.
But now my problem: I want to pass a filename to a dataport. This Dataport will be an objectID in a table. You can only run this with RUNMODAL and not being set as a variable. How can I do that? Roelof.
What does your problem differ from Denis problem?
Roelof, technically you probably have to declare the dataport as a variable to be able to access its properties. Simply speaking, you can not set properties to DP no 500, but need a specific instance of it. Example of setting the filename: (TheDataport is a variable, Datatype Dataport, Subtype “Import Rig Data”) IF NOT EXISTS(‘C:\Rigdata’ + FORMAT(TheCalcNumber)) THEN ERROR(‘The Rig Calc number is not valid!’); TheDataport.FILENAME(‘C:\Rigdata’ + FORMAT(TheCalcNumber)); TheDataport.RUNMODAL; CLEAR(TheDataport); I guess that you want to use the object ID to be able to choose between different dataports in runtime. But this could also be accomplished with declared variables type DP. Pelle