Showing results 1 to 8 of 8

Thread: how to set the curve name as the variable identification?

  1. #1

    Default how to set the curve name as the variable identification?

    How do I define the variable identification as the curve name in the picture switch function to the extended trend picture?
    Sub change_curve_varname_varid()
    
    'this procedure changes the name of the curve from the variable name to variable identification
    
    Dim myFunc As RtFunction
    Dim myVar As Variable
    Dim i
    Dim numCurves As Integer
    Set myFunc = MyWorkspace.ActiveDocument.RtFunctions.Item("a")
    If Not myFunc Is Nothing Then
    
        
        numCurves = myFunc.DynProperties("PictFilter[0].Curve[-1]")
        For i = 0 To numCurves - 1
        Set myVar = myFunc.DynProperties("PictFilter[0].Curve[i].VarInfo.Variable")
        If Not myVar Is Nothing Then
            myFunc.DynProperties("PictFilter[0].Curve[i].GraphName") = myVar.Tagname
        End If
        Next i
    End If
    
    End Sub

  2. #2
    Join Date
    30.05.2007
    Location
    Salzburg
    Posts
    880

    Default Re: how to set the curve name as the variable identification?

    in addition the Y-axis name of the trend (called "identification") curve can be also set with the variable identification:

    '..snip
    
        numCurves = myFunc.DynProperties("PictFilter[0].Curve[-1]")
        For i = 0 To numCurves - 1
        Set myVar = myFunc.DynProperties("PictFilter[0].Curve[i].VarInfo.Variable")
        If Not myVar Is Nothing Then
            myFunc.DynProperties("PictFilter[0].Curve[i].GraphName") = myVar.Tagname
            myFunc.DynProperties("PictFilter[0].Curve[i].Titel") = myVar.Tagname
        End If
        Next i
    
    '../snip

    note: the Y-axis curve name (called "identification") is normaly limited to 30 characters

  3. #3
    Join Date
    08.12.2013
    Posts
    27

    Default Re: how to set the curve name as the variable identification?

    Hi,

    Can anyone please guide how to implement this function to all curve?
    Facing the same issue, required to display variable identification as curve name instead of variable name.
    However, found this code only change the first curve name to identification, for the adding curve, it will display variable name instead.

    Please advice, how to display curve name / title as variable identification instead of variable name.
    Appreciated, please do a favor.
    Thanks.

  4. #4
    Join Date
    30.05.2007
    Location
    Salzburg
    Posts
    880

    Default Re: how to set the curve name as the variable identification?

    this thread will help you: http://www.copadata.com/forums/showthread.php?t=1218

    regards,
    herbert


  5. #5
    Join Date
    08.08.2013
    Posts
    44

    Default Re: how to set the curve name as the variable identification?

    Hi,

    the first code snippet in this thread works just for one curve in the extended trend. Please find attached a code snippet which changes all variable names to the variable identifications:

    Sub change_curve_varname_varid()
     
    'this procedure changes the name of the curve from the variable name to variable identification
    
    Dim myFunc As RtFunction
    Dim myVar As Variable
    Dim i
    Dim numCurves As Integer
    Set myFunc = MyWorkspace.ActiveDocument.RtFunctions.Item("SW_Trend")
    If Not myFunc Is Nothing Then
     
     
        numCurves = myFunc.DynProperties("PictFilter[0].Curve[-1]")
        For i = 0 To numCurves - 1
        Set myVar = myFunc.DynProperties("PictFilter[0].Curve[" & i & "].VarInfo.Variable")
        
        
        If Not myVar Is Nothing Then
            'set variable identification as curve name
            myFunc.DynProperties("PictFilter[0].Curve[" & i & "].GraphName") = myVar.Tagname
            'set variable identification as y-axis name
            myFunc.DynProperties("PictFilter[0].Curve[" & i & "].Titel") = myVar.Tagname
        End If
        Next i
    End If
     
    End Sub

    BR
    Christian

  6. #6
    Join Date
    08.12.2013
    Posts
    27

    Default Re: how to set the curve name as the variable identification?

    Hi Christian and Herberto,

    Yes, all curve name changed to variable identification once clicked on trending.
    However, when adding another curve inside the extended trend screen, following curve name doesn't change the curve name to variable identification.

    How to implement for every curve added, by default or by manual adding, curve name will display variable identification instead of variable name.

    Thanks very much

  7. #7
    Join Date
    08.12.2013
    Posts
    27

    Default Re: how to set the curve name as the variable identification?

    Hi Christian and Herberto,

    Yes, all curve name changed to variable identification once clicked on trending.
    However, when adding another curve inside the extended trend screen, following curve name doesn't change the curve name to variable identification.

    How to implement for every curve added, by default or by manual adding, curve name will display variable identification instead of variable name.

    Thanks very much

  8. #8
    Join Date
    08.08.2013
    Posts
    44

    Default Re: how to set the curve name as the variable identification?

    Hi yitlilee,

    You are right, just the curves which are added in zenon editor are shown with their identification, because the previous shown VBA-macro gets executed in the zenon editor and not in the runtime.

    If you want to add curves in the runtime, which also show the variable identification, you have to add them via a VBA-macro which gets executed in the runtime. Therefore, you can execute a predefined VBA-macro via a button, or you open the VBA editor in the runtime to add any curve and change the variable name to the variable identification (more flexible).

    With zenon standard functions, it's currently just possible to add curves in the runtime with the variable name.


    BR
    Christian

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •