Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Integration Service

Fetching Data Using PML Functions

  • Last UpdatedNov 06, 2023
  • 2 minute read

If you are using a Dabacon product as the data source, you can retrieve data using a PML function.

Note: The PML must not accept any arguments, must return Array of Array Object, must not contain PML.NET code or use of "CE" current element.

The process to fetch data using a PML function is as follows:

  1. Define a PML object in the data source at the following location: <installation location of the Dabacon product>\PMLLIB\design\objects\

    Note: The name of the object must be IntegrationSupport and the name of the file must be IntegrationSupport.pmlobj.

    The object must contain a call to the PML function. The following code is an example for the IntegrationSupport PML object:

    ------------------------------------------------------------------------

    define object IntegrationSupport

    endobject

    ----------------------------------------------------------------------

    define method .ListofSites() is ARRAY

    return !!ListofSites('')

    endmethod

    ----------------------------------------------------------------------

  2. Define a PML function at the following location: <installation location of the Dabacon product>\PMLLIB\design\functions\

    The return type of the function must be in Array and the output of the result must be in dimensional array. The following code is an example for a PML function:

    -- Function Type: Function/Procedure

    -- Arguments:

    -- [#] [R/RW] [Data Type] [Description]

    -- Return:

    -- [Data Type] [Description]

    --

    ------------------------------------------------------------------------

    define function !!ListofSites() is ARRAY

    -- Variable Declarations

    !resultArray = ARRAY()

    !output = ARRAY()

    --Define Variables for Columns------

    !colname=ARRAY()

    !coltype=ARRAY()

    !colowner=ARRAY()

    !coldesc=ARRAY()

    !colname.insert(1,'NAME')

    !coltype.insert(1,'TYPE')

    !colowner.insert(1,'OWNER')

    !coldesc.insert(1,'DESCRIPTION')

    -- Define Variables for Rows-------

    !name=ARRAY()

    !type=ARRAY()

    !owner=ARRAY()

    !desc=ARRAY()

    -- Collect all Sites here

    !resultArray = !!collectAllFor('SITE','',WORLD)

    do !item values !resultArray

    -- iterate through each item and add to the row array list

    !name.append(!item.NAME.STRING())

    !type.append(!item.TYPE.STRING())

    !owner.append(!item.OWNER.STRING())

    !desc.append(!item.Description.STRING())

    enddo

    !colname.append(!name)

    !coltype.append(!type)

    !colowner.append(!owner)

    !coldesc.append(!desc)

    !output.append(!colname)

    !output.append(!coltype)

    !output.append(!colowner)

    !output.append(!coldesc)

    return !output

    endfunction

  3. To fetch the data using a PML function, the client application needs to call the "GetData" method and pass the respective PML function defined in PML object file as the input parameter.

TitleResults for “How to create a CRG?”Also Available in