AnsweredAssumed Answered

Problem creating a PIExpression dataset in Processbook 2015 Version 3.5.0.284. 

Question asked by John_Fors on Jun 17, 2016
Latest reply on Jun 20, 2016 by John_Fors

I have yet to create a PIExpression dataset on the fly from vba that is successful.  The code creates the dataset but none of the properties are populated.

 

Public Function MakeAvailDS(TagName As String) As PIExpressionDataset

Dim myExp As String

Dim myDS As PIExpressionDataset

Dim myDataSets As Datasets

  On Error Resume Next

  Debug.Print DSSymbol.Name

 

  Set myDataSets = ThisDisplay.Datasets

  Set myDS = myDataSets.Add("Test", Nothing, True, 1, True, pbDatasetPIExpression)

  'Set myDS = myDataSets("Value3")

  'myDataSets.SetDataset myDS

 

  myExp = "TimeEq('" & TagName & "'," & ThisDisplay.StartTimeDS & ",'" & ThisDisplay.EndTimeDS & "', 0)" & _

            " / (parsetime(""" & ThisDisplay.EndTimeDS & """) - " & ThisDisplay.StartTimeDS & " ) * 100"

           

  Debug.Print myExp

  With myDS

    .ServerName = "SOCC"

    .Expression = myExp

'    .Expression = "'sinusoid'*3"

    .Description = "Edit at " & Now()

    .ColumnName = "Value"

    .RefreshInterval = 3600

    .Interval = "10M"

  End With

  myDataSets.SetDataset myDS

 

  Set MakeAvailDS = myDS

End Function

 

Thanks for your help.

Outcomes