Dashboard.InUse
SVB Example
Data Entry Example 9: Adding a MAS dashboard:
Sub Main
'The following example assumes that you have MAS licensed.
Dim oOM As ObjectManager
'Reconnect into Enterprise
Set oOM = New ObjectManager
oOM.Reconnect Application
'Specify the name of the dashboard and where it will be placed.
Dim dashInfo As New DashboardCreateInfo
dashInfo.AuditLogReason = "Creating bread dashboard"
dashInfo.Folder = "/Blake's Materials"
dashInfo.Name = "Bread Dashboard"
'Add the dashboard
Dim breadDashboard As Dashboard
Set breadDashboard = oOM.Dashboards.AddEx(dashInfo)
breadDashboard.AutoSave = False
'Add a description.
'Here, we will include a list of the bakeries in the description.
Dim BakeryList As String
Dim i As Long
Dim Bakeries As Label
Set Bakeries = oOM.Labels("Blake's Materials/Bakeries")
For i = 1 To Bakeries.LabelValueList.Count
BakeryList = BakeryList & Bakeries.LabelValueList.Item(i) & vbCrLf
Next
breadDashboard.Description = "Monitoring of Bread (" & _
oOM.Tasksets("/Blake's Materials/Bread Review").Description & ")." & _
vbCrLf & "This includes the following Bakeries:" & vbCrLf & _
BakeryList
'Enable it to run
breadDashboard.InUse = True
'Add a row of tasksets.
'Here we are just adding one taskset, which watches grain-level entries.
Dim ingredientsRow As DashboardRow
Set ingredientsRow = breadDashboard.Rows.Add("Ingredients Review")
Dim grainItem As DashboardRowItem
Set grainItem = ingredientsRow.Add(1, "Grain Review", _
oOM.Tasksets("/Blake's Materials/Bread Review"), oOM.Tasksets("/Blake's Materials/Bread Review").Tasks(1))
'Set it to use the QC icon
grainItem.Icon = oOM.Icons.Item(1)
'Set the permissions to be the same as the taskset
For i = 1 To oOM.Tasksets("/Blake's Materials/Bread Review").AccessControlList.Count
Set permissionItem = oOM.Tasksets("/Blake's Materials/Bread Review").AccessControlList.Item(i)
If permissionItem.IsUser Then
breadDashboard.AccessControlList.AddUser(permissionItem.Name, permissionItem.CanEdit)
Else
breadDashboard.AccessControlList.AddGroup(permissionItem.Name, permissionItem.CanEdit)
End If
Next
'commit our settings
Dim updateInfo As New DashboardUpdateInfo
updateInfo.AuditLogReason = "Setting up bread review dashboard"
breadDashboard.SaveEx(updateInfo)
'Now we will have a dashboard reviewing our bread measurements set to run at 6:00PM.
'Also, we should expect for this dashboard to stop because of an out-of-control sample alarm.
oOM.Disconnect
End Sub
Copyright © 2020. Cloud Software Group, Inc. All Rights Reserved.
