Code List lookups - HxGN EAM - 12.0.1 - Customization & Programming - Hexagon

HxGN EAM Web Services Toolkit Programmer

Language
English
Product
HxGN EAM
Search by Category
Customization & Programming
HxGN EAM Version
12.0.1

When the LookupButtonClickHandler finds date or datetime in the Tag property of the control that triggered the event, it attempts to display an instance of the Datastream.WinForms.Dialogs.LookupDlg.

The following steps outline the procedure for a code list lookup.

  • Create a LookupDlg variable, named dlg, to hold the new instance of LookupDlg.

    Dim dlg As New Datastream.WinForms.Dialogs.LookupDlg( Globals.Session, "WSJOBS", LOVDescription)

    The LookupDlg constructor requires a Session instance, a function name (WSJOBS), and a lookup description string. The function names, like WSJOBS or SMPART will vary depending on the lookup being used. See the HxGN EAM User's Guide to find the appropriate function name to use for the desired lookup. The lookup description string is described earlier in the list of available lookup types.

    The sample uses a global instance of the Datastream.EWS.Session class. This instance is accessed through the Session property of the Globals module that can be found in the Globals.vb file.

  • The dialog is displayed, and if the user did not Cancel the dialog the selection is assigned to the control.

    If dlg.ShowDialog(Me) = DialogResult.OK Then inputBox.Text = dlg.Selection

  • The rest of the code determines which control made the lookup request and determines if additional values from the selected row need to be stored. All the available values for the selected row are returned in the SelectionList property of the dialog. This property is an instance of the NameValuePairList class. The additional values are stored in variables to be used once the Submit button is clicked to create the new work order.

    The first case, in the following code, is notable in that in addition to storing off the equipment organization, it also retrieves the description of the selected equipment and assigns it to a separate control – the EquipmentDescTextBox control.

With dlg.SelectionList

Select Case True

Case inputBox Is Me.EquipmentNoInputBox If .Contains("equiporganization", True) Then m_EquipmentOrg=.Item("equiporganization",True).Value End If

If.Contains("equipmentdesc", True) Then Me.EquipmentDescTextBox.Text =.Item("equipmentdesc", True).Value End If

Case inputBox Is Me.ClassInputBox If.Contains("classorganization", True) Then m_ClassOrg =.Item("classorganization", True).Value End If

Case inputBox Is Me.LocationInputBox If.Contains("locorganization", True) Then m_LocationOrg =.Item("locorganization", True).Value End If

Case inputBox Is Me.CostCodeInputBox If.Contains("costorganization", True) Then m_CostCodeOrg =.Item("costorganization", True) . Value

End If

End Select

End With