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

AVEVA™ Mobile Operator

Single control extensions

  • Last UpdatedFeb 17, 2025
  • 2 minute read

This method displays a UI control for the custom function.

Method

IExtensionsUI.ShowUI(TemplateName,TemplateData)

Parameters

  • TemplateName: Following are the supported templates.

    • MPF_Dropdown: Template name for dropdown list control with string data.

    • MPF_Dropdown_Object: Template name for dropdown list control with key value data.

    • MPF_MessageBox: Template name for message box control.

  • TemplateData: Meta data for the UI object.

Dropdown list using String data (MPF_Dropdown)

This template has the following properties:

  • Title: Title of the drop down control.

  • Dropdown Title: Custom message for the drop down control.

  • Data: Contents of the drop down control.

Example:

The below example shows how to populate a Dropdown list Data with cause code string array.

local listData = {}

listData["Title"] = "SAP Response Lists"

listData["DropdownTitle"] = "Cause Codes"

listData["Placeholder"] = "Select Cause Codes"

local listArrayData = { "Cyclic Fatigue","GCB Coid Burnout","GCD Circuit Defective", "GCO Open Circuit","GCR Corrosion","CER Errosion"}

listData["Data"] = listArrayData

local listReturn = IExtensionsUI.ShowUI("MPF_Dropdown",listData)

Dropdown list using Key/Value data (MPF_Dropdown_Object)

This template has the following properties:

  • Title: Title of the drop down control.

  • Dropdown Title: Custom message for the drop down control.

  • Data: Contents of the drop down control.

Example:

The following example shows how to populate a Dropdown list Data with key/value pair strings fetched from SATM_Response_Lists Table.

local listData ={}

listData["Title"] = "Asset Selection"

listData["DropdownTitle"] = "Asset Display Names"

listData["Placeholder"] = "Select Asset Display Names"

local item ={}

local queryResult = IExtensionsQuery.Execute('select ResponseList_PK , Name from SATM_Response_Lists' ,{});

local data = queryResult["Rows"]

local col = queryResult["ColumnCount"]

local row = queryResult["RowCount"]

for i=1,row,1

do

local key = data[i][1]

local Value = data[i][2]

item[key] = Value

end

listData["Data"] = item

local selectedkey = IExtensionsUI.ShowUI("MPF_Dropdown_Object",listData)

Message box (MPF_MessageBox)

This control displays the message with or without an image.

Properties

  • Message Title: Title of the message.

  • Image: Image file for the message.

  • Message: Custom message for the task.

Example 1: Message box with hard-coded message and image

local messageData = {}

messageData["Title"] = "Custom Extension Alert"

messageData["MessageTitle"] = "Message Alert!"

messageData["Image"] = "7b399bd5975c47e4835c1284f354fb76.png"

messageData["Message"]= "<b>IMPORTANT NOTICE:</b><p>If the failures found during visual inspection can be corrected immediately, then correct failure and record <b>\"As Found\" as \"Fail\"</b>, with relevant failure code and record <b><u>\"As Left\"</u> as <font color=green>\"Pass\"</font></b>.</p><p>If failure cannot be corrected immediately, record <b>\"As Found\" and \"As Left\" as <font color=red>\"Fail\"</font></b> with relevant <b><i>failure code</i></b>.</li></ul>"

IExtensionsUI.ShowUI("MPF_MessageBox",messageData)

Example 2: Message box with message and image queried from a Table

local currentNode = IProcNode.CurrentNode

local taskID = currentNode["Id"]

local queryResult = IExtensionsQuery.Execute("select AD.filename, T.DESCRIPTION from SATM_AttachedDocuments AD inner join SATM_ITEM T on T.Attached_Doc_FK = AD.AttachedDocPK and T.ITEM_PK =@0",{taskID});

local data = queryResult["Rows"]

local messageData = {}

messageData["Title"] = "Custom Message Alert"

messageData["MessageTitle"] = "Warning Alert"

messageData["Image"] = data[1][1]

messageData["Message"]= data[1][2]

IExtensionsUI.ShowUI("MPF_MessageBox",messageData)

Note:

- Image in the message box is optional. The recommended size for the image is 50 pixels by 50 pixels. Remove the “Image” property to have the message box without an image.

- Message can be HTML encoded.

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in