Dialogs Methods

The following methods are included in the CxDialogs library. Use the Dialogs methods to invoke a CygNet dialog without importing the library. To use the methods in other environments, create a COM component from the Dialogs library.

Dialogs methods include the following:

ShowDataGroupDialog

The ShowDataGroupDialog method shows the Data Group dialog box. Also see CxScript.GlobalFunctions.ShowDataGroupDialog.

Syntax

ShowDataGroupDialog(UisOrDdsSiteService As String, FacilityId As String, DataGroupType As String, Ordinal As Integer)

Parameters

Parameter Required Description

UisOrDdsSiteService

Yes

The name of a valid UIS or DDS from which to get information in Site.Service format.

FacilityId

Yes

A valid facility ID.

DataGroupType

Yes

The Data Group Type of an existing data group.

Ordinal

Yes

The ordinal number corresponding to the exact data group to show. This is helpful if there are more than one data groups of the same type.

Example

The following example illustrates three ways to call this method. The first two methods display Discrete Output data groups, but the first method shows Ordinal 4 and the second shows Ordinal 5. The third method shows the properties dialog box for TESTMETER because no Data Group Type is specified.

Copy
ShowDataGroupDialog
Sub dataGrpDO4()
    'Shows the Discrete Output data group with an ordinal of 4
    ShowDataGroupDialog "CYGDEMO.UIS", "TESTMETER", "DO", 4
End Sub
 
Sub dataGrpDO5()
    'Shows the Discrete Output data group with an ordinal of 5
    ShowDataGroupDialog "CYGDEMO.UIS", "TESTMETER", "DO", 5
End Sub

Back to top

ShowFacilityRulesDialog

The ShowFacilityRulesDialog method displays the Facility Rules dialog box. Also see CxScript.GlobalFunctions.ShowFacilityRulesDialog.

Syntax

ShowFacilityRulesDialog(InRules As String) As String

Parameters

Parameter Required Description

InRules

No

An optional parameter allowing the input of human-readable text or XML to initialize the filter in the dialog box. If this parameter is not specified, the dialog box will not contain any filters upon initialization.

Remarks

This method will return the Facility Rule Filter XML created by the dialog box.

Example

The following is an example of a Facility Rule Filter XML which filters all facilities where facility_category = "GENFAC" AND facility_siteservice = "CYGDEMO.UIS".

Copy
Facility Rule Filter XML
<ExportedRules exportTime="9/24/2023 07:37:46.621" ruleDataIdentifier="FAC Rules">
    <Rules enabled="true" inverted="false" op="1" name="">
        <Rule enabled="true" name="" referenceAttr="0" compareToType="0" externalData="" value="GENFAC" operator="=" qualifer="Case Insensitive">
            <compareItem attr="facility_category"/>
        </Rule>
        <Rule enabled="true" name="" referenceAttr="0" compareToType="0" externalData="" value="CYGDEMO.UIS" operator="=" qualifer="Case Insensitive">
            <compareItem attr="facility_siteservice"/>
        </Rule>
    </Rules>
</ExportedRules>

 

Note:
The XML for the filter rule uses the spelling "qualifer=" rather than "qualifier=". See Adding Filter Rule Definitions for an explanation of this discrepancy.

Example

The following example launches the Facility Rules dialog box and displays the generated rules in a message box.

Copy
ShowFacilityRulesDialog
Sub
    Dim Dialogs
    Set Dialogs = CreateObject("CxDialogs.Dialogs")
     
    Dim strRules
    strRules = Dialogs.ShowFacilityRulesDialog("")
     
    MsgBox strRules
End Sub

Back to top

ShowFacilityRulesDialogSimple

The ShowFacilityRulesDialogSimple method displays the Facility Rules dialog box. The optional InRules parameter allows both "simple" human-readable text and XML as the input to initialize the filter. The method will also output only human-readable text. Also see CxScript.GlobalFunctions.ShowFacilityRulesDialogSimple.

Notes:

This function differs from ShowFacilityRulesDialog only in that it allows input and output of simplified text. The Facility Rules dialog box will look the same regardless of the function used for invocation.

The human-readable text can be used in the ReferenceFacility property for any CygNet-aware Studio tool.

Syntax

ShowFacilityRulesDialogSimple(InRules As String) As String

Parameters

Parameter Required Description

InRules

No

An optional parameter allowing the input of human-readable text or XML to initialize the filter in the dialog box. If this parameter is not specified, the dialog box will not contain any filters upon initialization.

Remarks

This method will return the human-readable filter text created by the dialog box.

Examples

The following is an example of a facility rule filter input in text format which filters all facilities where facility_id = "TANK1" OR facility_id = "TANK2".

Copy
Facility Rule Filter
facility_id = ToCaseInsensitive('TANK1') OR facility_id = ToCaseInsensitive('TANK2')

The following example launches the Facility Rules dialog box and displays the generated rules in a message box.

Copy
ShowFacilityRulesDialogSimple
Sub
    Dim Dialogs
    Set Dialogs = CreateObject("CxDialogs.Dialogs")
     
    Dim strRules
    strRules = Dialogs.ShowFacilityRulesDialogSimple("")
     
    MsgBox strRules
End Sub

Back to top

ShowRelativeTimeDialog

The ShowRelativeTimeDialog method displays the Relative Time dialog box. Also see CxScript.GlobalFunctions.ShowRelativeTimeDialog.

Syntax

ShowRelativeTimeDialog(InTime As String) As String

Parameters

Parameter Required Description

InTime

No

An optional string used to initialize the Relative Time dialog box.  This string can be in one of the following formats:

  • Absolute Date/Time — for example, 1/4/2023 1:08:00
  • Relative Date/Time — for example, y-1 m-1 d-1 H-1 M-1 S-1
  • Relative Day — for example, T-1 or T+1 (interpreted as "today plus/minus # of days)

If this parameter is not specified, the dialog box will be initialized to the current date and time.

Remarks

This method will return a string representing the time configured in the dialog box.  This format of this string will vary depending on the type of date time configured in the dialog box.  If "Absolute Date/Time" is selected, the format of the returned string will be "(M)M/(D)D/YYYY (H)H:MM:SS".  If "Relative Date/Time" is selected, the format of the returned string will be "y+/-# m+/-# d+/-# H+/-# M+/-# S+/-#" or "<Current>" if no relative date/time parameters are adjusted.  If "Relative Day" is selected, the format of the returned string will be "T+/-#".

Example

The following example launches the Relative Time dialog box initialized to one year ago from the current time, and displays the result in a message box.

Copy
ShowRelativeTimeDialog
Sub
    Dim Dialogs
    Set Dialogs = CreateObject("CxDialogs.Dialogs")
     
    Dim strTime
    strTime = Dialogs.ShowRelativeTimeDialog("y-1")
     
    MsgBox strTime
End Sub

Back to top

ShowRollupConfigDialog

The ShowRollupConfigDialog method displays the History Rollup Configuration dialog box. Also see CxScript.GlobalFunctions.ShowRollupConfigDialog.

Syntax

ShowRollupConfigDialog(TimeAdjustment As Variant, RollupType As Variant, RollupPeriod As Variant, Units As Variant, TopOfSubUnit As Variant)

Parameters

Parameter Required Description

TimeAdjustment

Yes

The time adjustment returned by the dialog box. 

This string will match the date time configured in the Time Adjustment edit box.

RollupType

Yes

The rollup type returned by the dialog box. 

This string will match the string selected in the Rollup Type combo box.

RollupPeriod

Yes

The rollup period returned by the dialog box.

This string will match the number configured in the Rollup Period edit box.

Units

Yes

The Units returned by the dialog box.

This string will match the string selected in the Units combo box.

TopOfSubUnit

Yes

The top of subunit offset returned by the dialog box.

This string will match the number configured in the Top of SubUnit edit box.

Example

The following example launches the History Rollup Configuration dialog box and displays each returned parameter in a message box.

Copy
ShowRollupConfigDialog
Sub
    Dim Dialogs
    Set Dialogs = CreateObject("CxDialogs.Dialogs")
     
    Dim vTimeAdj, vType, vPeriod, vUnits, vTOS
    Dialogs.ShowRollupConfigDialog vTimeAdj, vType, vPeriod, vUnits, vTOS
     
    MsgBox vTimeAdj
    MsgBox vType
    MsgBox vPeriod
    MsgBox vUnits
    MsgBox vTOS
End Sub

Back to top

ShowServiceInfoDialog

The ShowServiceInfoDialog method displays the Service Information dialog box for the specified site and service pair.

Syntax

ShowServiceInfoDialog(DomainSiteService As String)

Parameters

Parameter Required Description

DomainSiteService

Yes

A valid site and service, in "[domain]Site.Service" format, for which to show service information.

Note: If [domain] is not supplied, the ambient domain is searched.

Default value is [blank]

Remarks

This method will return false if the supplied parameter is invalid.

Example

The following example launches the CygNet Service Information dialog box and displays the data for the chosen [Domain]Site.Service.

Copy
ShowShowServiceInfoDialog
Sub
    Dim Dialogs
    Set Dialogs = CreateObject("CxDialogs.Dialogs")
     
    Dialogs.ShowShowServiceInfoDialog "CYGDEMO.RSM"
End Sub

Back to top

ShowUisCmdAuxDialog

The ShowUisCmdAuxDialog method displays the UIS Command Auxiliary Information dialog box. Also see CxScript.GlobalFunctions.ShowUisCmdAuxDialog.

Syntax

ShowUisCmdAuxDialog(UisOrDdsSiteService As String, FacilityId As String, UisCmdName As String) As Boolean

Parameters

Parameter Required Description

UisOrDdsSiteService

Yes

The name of a valid UIS or DDS from which to get information in Site.Service format.

FacilityId

Yes

The facility ID for which to modify UIS command auxiliary information.

UisCmdName

Yes

The name of the UIS command for which to modify auxiliary information.

Remarks

This method will return false if any of the supplied parameters are invalid.

Example

The following example launches the UIS Command Auxiliary Information dialog box.

Copy
ShowUisCmdAuxDialog
Sub
    Dim Dialogs
    Set Dialogs = CreateObject("CxDialogs.Dialogs")
     
    Dim vTimeAdj, vType, vPeriod, vUnits, vTOS
    Dialogs.ShowUisCmdAuxDialog "CYGDEMO.UIS", "FLOWAUTOAP15", "RTUCFGGET"
End Sub

Back to top

ShowUisCmdStateDialog

The ShowUisCmdStateDialog method shows the UIS Command State dialog box. Also see CxScript.GlobalFunctions.ShowUisCmdStateDialog.

Syntax

ShowUisCmdStateDialog(UisOrDdsSiteService As String, FacilityId As String, UisCmdName As String, ShowExecutionPrompt As Boolean) As Boolean

Parameters

Parameter Required Description

UisOrDdsSiteService

Yes

The name of a valid UIS or DDS from which to get information in Site.Service format.

FacilityId

Yes

A valid facility ID.

UisCmdName

Yes

The name of a UIS Command in the FacilityId.

ShowExecutionPrompt

Yes

Set to True to show a button to execute the UIS Command, set to False to hide the button.

Remarks

Return Value: A Boolean indicating whether the operation was successful. If ShowExecutionPrompt is set to False, this method will automatically return True.

Example

The following example shows the dialog box for the POLL command and is used to execute it.

Copy
ShowUisCmdStateDialog
Sub showCmdDialog()
    Dim bRet
    bRet = ShowUisCmdStateDialog ("CYGDEMO.UIS", "CYG_METER", "POLL", True)
    If bRet Then
        edtMessageBox.Text = "Successful execution"
    Else
        edtMessageBox.Text = "Error executing command"
    End If
End Sub

Back to top