Helllo Everyone,
I am having trouble checking to see if a dataset already exists. I am automating a dashboard and I need to verify if a particular dataset is there or not. If the dataset isn't there then I would like to create it. Currently I am capable of creating the dataset and implementing it as I see fit. However, my attempts at an if statement seems to not be working. Below is the code i've been using with specifcs ommitted. I attempted the remove dataset method, but if the dataset is in use it errors and causes hang up.
If MyDatasets.Item("NAME") = False Then
Set MyDataset = MyDatasets.Add("name", Nothing, True, 1, True, pbDatasetPIExpression)
Set MyDataset = MyDatasets.GetDataset("NAME")
MyDataset.ServerName = "SERVERNAME"
MyDataset.Expression = "(timeeq(TAGNAME, '*', '*-1h',STATUS))/3600"
MyDataset.RefreshInterval = 3600
MyDataset.ColumnName = "Value"
MyDataset.Interval = "10m"
MyDatasets.SetDataset MyDataset
End If
Thanks for your help in advance!
-Mike