DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Why is not a private variable accessible to all methods in a class of my script?

Hello all! I hope someone can help me with my problem with Diadem and VBScript

 

In the `Class TelltaleCycle` the private variable `p_FunctionType` is modified for the first time in `Public Property Let TimestampCh(value2let)` and then it is accessed in `Public Property Get HowManyPeriods`. Although this variable should hold the value written in the `Public Property Let TimestampCh(value2let)` it is read as empty in `Public Property Get HowManyPeriods`. I can not figure out why of this behavior!

In the `Class BeltminderCycle` Im doing almost the same thing and it is working as expected.

 

PS: becareful while reading my code because the variable name `p_FunctionType` is used in other class as well.

 

This such class is in Seatbelt_Library.vbs and the main code is attached. I also attached the TDM file with the channels used in the code to help debugging if necessary.

 

Thanks in advance!

0 Kudos
Message 1 of 2
(3,157 Views)

Make the script debuggable you need to add the tdm related tdx file too. Else the tdm file is not loadable.

 

Maybe adding

me.

at some points might help you to find the issue.

 

Option Explicit

class CPropTest

  public property get abc()
    if isempty(abc_) then
      abc_ = 1
    end if
    abc = abc_
  end property

  public property let abc(dVal)
    abc_ = dVal
  end property

  Public Property Get abcTwice
    dim abc : abc = 7
    abcTwice = me.abc + me.abc
  end Property

  Private Sub Class_Initialize()
    abc_ = empty
  End Sub

  private abc_
  
end class

dim propTest : set propTest = new CPropTest

dim txt : txt = ""

txt = txt & propTest.abc & VBCRLF
propTest.abc = 17
txt = txt & propTest.abc & VBCRLF
txt = txt & propTest.abcTwice & VBCRLF

MsgBox txt

 

0 Kudos
Message 2 of 2
(3,136 Views)