Compartilhar via


RUN Function (XMLport)

Loads and executes the XMLport that you specify.

XMLport.RUN (Number [, ReqWindow] [, Import] [, Record])

Parameters

  • XMLport
    Type: XMLport The variable is automatically cleared after this function runs.
  • Number
    Specifies the XMLport to run.
  • ReqWindow
    Specify true to show request page; specify false to run the report and skip the request page. This parameter overrides the setting of the UseRequestPage Property of the XMLPort. If you do not provide a value for the ReqWindow parameter, then the setting of the UseRequestPage property is used.

    Important

    Microsoft Dynamics NAV Web client and Microsoft Dynamics NAV Portal Framework for Microsoft SharePoint 2010 do not support request pages with XMLports. If the XMLPort will appear in the Microsoft Dynamics NAV Web client or a Microsoft SharePoint site, then you should set the value to false; otherwise, you will get an error at runtime.

  • Import
    Specifies whether the XMLPort imports or exports data. Specify true to run the XMLport and import data; specify false to export data. This parameter is most relevant when the XMLport does not use a request page and the Direction Property of the XMLport is set to Both. In this instance, you use the parameter to specify the direction of the data. If the XMLport uses a request page, then a direction option appears on the request page that enables the user can choose to import or export data. The Import parameter specifies the default value in the direction on option on the request page. If the Direction property is set to Import or Export, then you must set this parameter to match the direction that is set by the Direction property; otherwise, you will get an error at runtime. The default is true.
  • Record
    The record to use in the XMLport. The system will use any filters that are attached to the specified record.

Example

The following example creates a codeunit that runs the XMLport that has ID 50002, runs a request page that lets the user set filters, and exports data from the Customer table. On the request page, you can either open the file and view it or save it as an XML document on your computer. This example assumes that you have created an XMLport and saved it with ID 50002. For more information about how to create an XMLport, see How to: Design XMLports. This example requires that you create the following variable in the C/AL Globals window.

Variable name DataType Subtype

varRec

Record

Customer

XMLPORT.RUN (50002, TRUE, FALSE, varRec);

See Also

Tasks

How to: Design XMLports

Reference

XMLport Data Type