GUID

The GUID component is used to display a list of options. GUID lists can be generated in numerous ways and as a result are broken up into separate field types, the following GUID field types are handled by this component:

  • GUID Concepts
  • GUID Config List
  • GUID Field Options
  • GUID TSQL
  • GUID TSQL Instance
  • GUID TSQL Root

GUID fields have multiple display types as shown below.

TSQL Stored Procedures

The following GUID fields require a TSQL Stored Procedure:

  • GUID TSQL
  • GUID TSQL Instance
  • GUID TSQL Root

Below it’s discussed further how to make TSQL Stored Procedures for each GUID field type.

GUID TSQL

The GUID TSQL requires a custom stored procedure to call to function. To create a custom stored procedure, use the provided template GuidTSQLTemplate found in the attachments section. Follow the comments within the template to successfully create a stored procedure that can be used for the GUID TSQL field.

GUID TSQL Instance

In most cases you can specify the GI_ListInstances stored procedure to be called. This should cover most use cases. However, in the case where GI_ListInstances doesn’t produce the required results then you can create a custom TSQL stored procedure.

To create a custom stored procedure, use the provided template GuidTSQLInstanceTemplate found in the attachments section. Follow the comments within the template to create an alternate TSQL stored procedure to call instead of GI_ListInstances.

GUID TSQL Root

In most cases you can specify the GI_ListNestedInstances stored procedure to be called. This should cover most use cases. However, in the case where GI_ListNestedInstances doesn’t produce the required results then you can create a custom TSQL stored procedure.

To create a custom stored procedure, use the provided template GuidTSQLRootTemplate found in the attachments section. Follow the comments within the template to create an alternate TSQL stored procedure to call instead of GI_ListNestedInstances.

Component Code

The code for the component begins with all the standard parameters and declaring all the required variables for the component. Following the variables are the methods that are described below.

OnParametersSetAsync()

This method is called when the component initializes and when there’s an update to the parent component. The purpose of this method is assign values to the component variables.

UpdateSelectedOptions(FieldOption item, bool isEnabled)

This method is called when an item in the list is updated when using the Multi Select Switches display type. Its purpose is to update the SelectedOptions and OptionsList variables and call ValueChanged().

UpdateSelectedChips(List<FieldOption> selectedChips)

This method is called when an item is selected when using the single select chips or multi select chips display type. Its purpose is to update the SelectedChips list and ValueUX, then call ValueChanged().

ValueChanged()

This method is called when the value of the selected item(s) in the guid list changes. If the field is modifiable then the new value is validated and ChangeXML() is called. If the Display Type is Multi Select, Multi Select Switches, or Multi Select Chips then no validation is performed and ChangeXML() is called.

ChangeXML()

This method is used to update the XML of the instance to reflect the selected GUID item(s). When called XML is generated based on the value of DisplayType. Once the XML has been generated a call is made to the ChangeField method on myInstance and the new XML is passed. If auto postback is enabled, it will also save the current instance and reload it.

Below are examples of the XML format that is saved for each display type.

Multi Select, Multi Select Switches, and Multi Select Chips:

<GuidMultiSelect AllCheckedItems="A,B,C">
    <SelectedItem>A</SelectedItem>
    <SelectedItem>B</SelectedItem>
    <SelectedItem>C</SelectedItem>
</GuidMultiSelect>

Dropdown Combo Box, Single Select, and Single Select Chips:

<GuidField GUID="00000000-0000-0000-0000-000000000000">Item 1</GuidField>

LoadInstance()

This method is called when the JumpButton is selected. If the jump button is enabled, then when an option from the list is selected a jump button will appear next to the combo box. When the button is selected the method attempts to load the instance of the selected option.

IMPORTANT NOTE:
A Jump button is only available when the Drop-Down List option is selected in the field definition.

DisposeInstanceWindow(DotNetObjectReference<InstanceWindow> instanceWindowObjRef)

This method is called when the instance window component is closed. It’s purpose is to dispose the component hide the window.

Updated on January 8, 2024

Article Attachments

Was this article helpful?

Related Articles

Need Support?
Can’t find the answer you’re looking for? Don’t worry we’re here to help!
Contact Support

Leave a Comment