Dataport Filters Based on Non-Record Value

matttraxmatttrax Member Posts: 2,309
My question concerns setting dataport filters before the request form opens. I know that I can do this like
Dataport.RUNMODAL(DATAPORT::myDataport, TRUE, myRecord)
but that doesn't work as I want it to.

I want to run the dataport directly. As in if I was in Object Manager and clicked run the filters would pre-populate.

I would also settle for a way to add two text boxes to the options tab and not have the file name box disappear. I know I could fill in the boxes that way and use those to filter, but the I don't have a filename.

Thanks for your help,

Comments

  • krikikriki Member, Moderator Posts: 9,110
    Pre-populate the filters and then editing is not possible. You can set the filters in the OnPreDataport. This trigger fires when you have hit the Ok-button.

    To have the Filename-box NOT disappear, you need to create a field in which you put a text in which you want to have the filename.
    This TextBox MUST HAVE the following properties:
    -ID=1
    -AssistEdit=Yes

    Putting the filename in the CurrDataport.Filename must be handled by some programming (CurrDataport.Filename := txtTheFileName;) in the OnPreDataport-trigger
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Cem_KaraerCem_Karaer Member Posts: 281
    What if it is an export? Well if I give 1 for the ID of the textbox, the dialog box allows me to select only an existent file name. But in the export scenario, create file dialog box must pop-up.
    Cem Karaer @ Pargesoft
    Dynamics NAV Developer since 2005
  • Cem_KaraerCem_Karaer Member Posts: 281
    Here is the reply for the first question. In order that your dataport has the filters, you must set filters of your record variable first. The same is also true when running reports.
    The code must look like:
    myRecordVariable.SETRANGE("One of my field",myfiltervalue);
    myRecordVariable.SETRANGE("My other field",myotherfiltervalue);
    ect.
    DATAPORT.RUN(DATAPORT::"My dataport name",TRUE,myRecordVariable);
    
    Cem Karaer @ Pargesoft
    Dynamics NAV Developer since 2005
  • Cem_KaraerCem_Karaer Member Posts: 281
    For previewing a dataport/report ect. automatically, also look

    http://www.mibuso.com/forum/viewtopic.p ... highlight=
    Cem Karaer @ Pargesoft
    Dynamics NAV Developer since 2005
Sign In or Register to comment.