in location

OR

I'm looking for

  • Wholesalers
    • Uncheck All Check All
  • EXPERTISE
    • Expand
    • Expand
    • Expand
    • Uncheck All Check All
  • Switchboard Manufacturers
    • Uncheck All Check All
OR

The best way to see what Clipsal electric products can do for your home is seeing them in action at a Clipsal Powerhouse Display Centre.

Product stock may vary according to location. If you're after a specific product range, please check with your chosen location before visiting.

10 Results
    Load More Load Complete
    Change Location

    Example of mimic script to populate dropdown list with user and set selected user as Duty User in user roster

    This sample program is intended to demonstrate one or more programming functions or methods and is presented as programming example only. Schneider Electric assumes no liability for the use or application of this example program or any portion thereof.
     


    This example shows how a dropdown list can be populated with a list of ClearSCADA users and how a user can be selected from the list and be set as Duty User in a user roster.
     
    Sub PopulateDropdownListExample
     
    Dim frmComboBox, frmOKButton, frmCancelButton
    Dim sqlUserLookupRows, sqlUserLookupRowsCount
    Dim oSelectedUser, oComboArray()
    Dim c,r
     
    'Retrieve a list of all users from the database. This portion could be improved further by getting a list of users for a particular user roster
    ' instead of showing a list of all users
    Set sqlUserLookup = Server.Query("SELECT FullName FROM CDBUSER")
    sqlUserLookupRowsCount = sqlUserLookup.RowCount
     
    'Set size of the array to match the number of users returned by the above SQL query
    'This will be needed at the end to cross reference the selected row in the dropdown list with the actual users
    ReDim oComboArray(sqlUserLookupRowsCount)
     
    'Define the user roster object. In this example, the user roster object is called User Roster and is located in group Example and sub-group Set User Roster)
    Set oUserRoster = Server.FindObject("Examples.Set User Roster.User Roster")
     
    'Display a VB form
    Form.Init "Please make a selection"
    Form.AddGroupBox 0,0,100,8,""
    Set frmComboBox = Form.AddComboBox(0,1)
     
    'Populate the dropdown list with the list of users retrieved from the database earlier
    If Not(sqlUserLookup.Error) Then
     
    sqlUserLookupRows = sqlUserLookup.Rows
    sqlUserLookupColumns = sqlUserLookup.ColumnNames
     
    For r = 0 To (sqlUserLookup.RowCount - 1)
    For c = 0 To (sqlUserLookup.ColumnCount - 1)
    frmComboBox.Add(sqlUserLookupRows(r,0))
    oComboArray(r) = sqlUserLookupRows(r,0)
    Next
    Next
    Else
    Msgbox sqlUserLookup.ErrorMessage, vbCritical + vbOKOnly, "Error in SQL Command"
    End If
     
    frmComboBox.Selection = 1
    Set frmOKButton = Form.AddPushButton(60,5,"OK")
    frmOKButton.Default = True
    Set frmCancelButton = Form.AddPushButton(75,5,"Cancel")
    Form.Show
     
    'Pass the selected user when calling the SetDutyUser method. Note, the selected user has to be configured in the user roster this this part of the example to work.
    oSelectedUser = oComboArray(frmComboBox.Selection)
    msgbox oSelectedUser + " is selected"
    oUserRoster.Interface.SetDutyUser oSelectedUser
     
    End Sub

    Didn’t find what you were looking for?

    Try Searching Again View Our Categories

    Need further assistance?

    Our Customer Care department provides total customer service solutions for our residential, industrial and commercial applications.

    Get Assistance