AnsweredAssumed Answered

"Specified cast id not valid" error in filter summaries method

Question asked by PrasadChaudhari01 on Jun 21, 2019
Latest reply on Jun 21, 2019 by Rick Davin

Hello Folks,

 

Hope all you are doing great ! ! !

 

I am developing one calculation where i am using IPIdata2 method. But while using it i am getting error "Specified cast is not valid". below is my code and the error i am getting.

Code:

Dim dtstarttime As Object
Dim dtendtime As Object
Dim ValSum1 As NamedValue
Dim ValSum2 As NamedValue
Dim Filter_Exp1 As Strig
Dim Filter_Exp2 As String
Dim Duration As Object

piInput1_calc = piI_Input1.Data
piInput2_calc = piI_Input2.Data
'fetching the calculation execution time and storing it
dtExecutionTimeStamp = New Date(1970, 1, 1, 0, 0, 0).AddSeconds(O_Output1.ExeTime()).ToLocalTime()
'assigning filter expression
Filter_Exp1 = "('" & piI_Input2.Name & "'<> 1)"
Filter_Exp2 = "('" & piI_Input2.Name & "'= 1)"

dtstarttime = dtExecutionTimeStamp.AddHours(-24)
dtendtime = dtExecutionTimeStamp

Duration = "24h"

ValSum1 = piInput1_calc.FilteredSummaries(dtstarttime, dtendtime, Duration, Filter_Exp1, ArchiveSummariesTypeConstants.asAverage, CalculationBasisConstants.cbTimeWeighted, FilterSampleTypeConstants.fstExpRecordedValues)

 

Error:

I have follow all the rules for the but still i am getting this error. not understanding what I am doing wrong here. could you please help me to fix this ?

 

Happy PI ! ! ! 

Regards,

Prasad

Outcomes