Page 1 of 2 1 2 LastLast
Showing results 1 to 10 of 13

Thread: Browse for variable in RT

  1. #1
    Join Date
    26.10.2009
    Posts
    20

    Frage Browse for variable in RT

    Hi

    Is there a way in Runtime to browse the variables and get the name of the selected variable?

    I have a Link text element linked to a String variable. When I click this element in Runtime I would like a dialog/pop-up where I can select any variable from the project. The name of the selected variable should be transferred to the String variable.

    6.22 SP1 Build8

    Regards

  2. #2

    Default Re: Browse for variable in RT

    Hello,

    with VBA events you are able to react on Element Mouse Events, see screenshot.
    Click image for larger version

Name:	ScreenShot696.jpg
Views:	81
Size:	91.4 KB
ID:	346

    With the event you get the Element Object which leads you to the currently assigned variable. You are also able to parse all variables existing in the project, the object thisproject.variables is the listing of all variables.

    For this topic also check out the so called "Lasso" functionality which allows even drag and drop of variables or values from one object to the other.

  3. #3
    Join Date
    30.05.2007
    Location
    Salzburg
    Posts
    879

    Default Re: Browse for variable in RT

    Can you please tell what you exactly want to realize?
    What should be afterwards possible having the selcted variable name in the Link-Text element?

    Maybe a standard zenon functionality does exist for this....

    Regards,
    Herbert

  4. #4
    Join Date
    26.10.2009
    Posts
    20

    Default Re: Browse for variable in RT

    We have a main project with several identical dummy sub-projects. At installation at the customer some off the dummy sub-projects are replaced by one off our real projects (matching a specific device).
    It is possible to install a real project into several dummy projects at the same customer if they have more than one of the same kind of device.

    We have a picture in the main project where it is possible to write a variable name in a Link-text element.
    Using VBA we detect a change in the Link-text string variable (using OnlineVariable) and search through the sub-projects for the entered variable name and display the value from each of the sub-projects.
    We can not link the variables to the main project in the editor because we do not know the configuration of the sub-projects before installation at the customer.

    I hoped there was some way to open a dialog like the one in the attached screen shot (it is from a Variables status test picture > Picture type spec. function: Add variable...)
    It should furthermore be possible to select variable from any project, not only the main project.
    There are a lot of variables and it is impossible to remember them all so a dialog with search/filter options would be nice

    Hope it makes sense
    Attached Thumbnails Attached Thumbnails zenOn select variable.png  

  5. #5
    Join Date
    30.05.2007
    Location
    Salzburg
    Posts
    879

    Default Re: Browse for variable in RT

    So why not using the "Variable Status Test" picture itself?
    - for each Sub-Project you have to create a "Variable Status Test" picture and a picture switch function
    - in the Integration-Project you then have the buttons where the different picture switch functions to the "Variable Status Test" pictures of the Sub-Projects are linked

    Regards,
    Herbert

  6. #6
    Join Date
    26.10.2009
    Posts
    20

    Default Re: Browse for variable in RT

    Because it should be possible to view the values of the variable in each sub-project at the same time. E.g. to fast compare a temperature measured by each of the connected devices.

  7. #7
    Join Date
    29.07.2007
    Location
    Germany
    Posts
    191

    Default AW: Re: Browse for variable in RT

    Quote Originally Posted by mvj View Post
    Because it should be possible to view the values of the variable in each sub-project at the same time. E.g. to fast compare a temperature measured by each of the connected devices.
    I just want to second this request!

    I am waiting for a long time to get "Variable Status Test" picture in an integration project, which can show variables of different sub project at the same time.

    Hopefully other users looking for this possibility will join this thread.

    H.-P.
    string zenon = "7.60 Build52515 / 8.00 Build52082";
    string Windows = "7 / 10 / 2012R2";
    string VMware = "Workstation / VMware ESXi";

  8. #8
    Join Date
    30.05.2007
    Location
    Salzburg
    Posts
    879

    Default Re: Browse for variable in RT

    I am waiting for a long time to get "Variable Status Test" picture in an integration project, which can show variables of different sub project at the same time.

    Hopefully other users looking for this possibility will join this thread.
    Viewing variable values project wide in the "Variable Diagnosis" picture is possible with zenon 6.50 SP0

    @mvj: So if upgrading to zenon 6.50 you can to this without VBA (furthermore you then would not have to care about reading variable values via VBA -> they have to be advised for reading... )

    Also some enhancement in the Variable Diagnosis picture have been implemented in zenon 6.50:
    - Now variables from other projects can be displayed
    - A new column displays the variable address
    - Write set value is possible for single variables
    - Status changes
    - Additional parameters when the screen is called: Display the filter dialog in the Runtime, set base for values and activate cyclic update
    - The screen is now also available for the web client.
    - exponential display


    -> see also Release notes of zenon 6.50


    Regards,
    Herbert

  9. #9
    Join Date
    26.10.2009
    Posts
    20

    Default Re: Browse for variable in RT

    No doubt we will upgrade to 6.50 in the future but for right now is there no possible way in 6.22?

  10. #10
    Join Date
    30.05.2007
    Location
    Salzburg
    Posts
    879

    Default Re: Browse for variable in RT

    Of course you can loop via VBA through all variables in every subproject (as mentioned by WofgangM in the first reply)....

    Sub GetVariableValue()
    
    Dim obProjects As Projects
    Dim obProject As Project
    Dim obVars As Variables
    Dim obVar As Variable
    Dim iProject As Integer
    Dim iVars As Integer
    
    Dim strVarName As String
    
        strVarName = "Sub_Var1" 'this would be the varname you get from the linked-text element
        
        Set obProjects = thisProject.Parent
        'loop through the projects
        For iProject = 0 To obProjects.Count - 1
            Set obProject = obProjects.Item(iProject)
            Set obVars = obProject.Variables
            'loop through the variables within the given project
            For iVars = 0 To obVars.Count - 1
                Set obVar = obVars.Item(iVars)
                If Not obVar Is Nothing Then
                    'check if the variable matches the name
                    If StrComp(obVar.Name, strVarName) = 0 Then                    
                        'check if the variable value can be read via VBA (variable needs to be advised and a valid value)
                        If obVar.IsOnline = True Then
                            Debug.Print obVar.Value
                        Else
                            Debug.Print obVar.Name & " is not online!"
                        End If                        
                    End If            
                End If
                Set obVar = Nothing
            Next iVars
            
            Set obVars = Nothing
            Set obProject = Nothing
        Next iProject
    End Sub

    In order to get the Variable "online" you do have following possiblities:

    - OnlineContainers (see http://www.copadata.com/forums/showthread.php?t=41)
    - using the DDE Option (at Variable itself: Additonal Settings -> DDE active)
    - variable is shown at the actual displayed picture in the runtime
    - variable is defined as alarm / in CEL
    - variable is defined in an running archive
    - variable is definied with HD storage
    - variable is used within an allocation (Source / Trigger)


    Regards,
    Herbert

Similar Threads

  1. Cannot browse Profinet devices
    By markusw in forum straton / zenon Logic
    Replies: 0
    Last Post: 21st August 2007, 09:06

Posting Rules

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