Showing results 1 to 10 of 10

Thread: Copying variables

  1. #1
    Join Date
    02.04.2012
    Posts
    5

    Default Copying variables

    Hi everybody, I would to know how to copy zenon variable in C# (eventually VBA), I have searched this forum, zenon documentation and found nothing. I really appreciate if someone help me.

  2. #2

    Default Re: Copying variables

    Hi fib11235 and welcome to the forum!

    There is no method for copying a variable in the programming interface, like there is in the user interface.

    What you could do is, XML export the variable you want to copy through the programming interface, change the name in the XML file through the programming interface, and import the XML file again.

    Although it might be easier to simply create a new variable in the programming interface, and set the properties accordingly.

    Best regards,
    Mark

  3. #3
    Join Date
    02.04.2012
    Posts
    5

    Default Re: Copying variables

    Ok, so how export variable through the programming interface, because I only found method which exports all variables.

    By now I copy variables, as you write, by creating new one and setting properties, but there is one issue, some properties are read only and I don't know how check witch one. If I set readonly property, the wizard throws exception and is terminated.

    Regards

  4. #4

    Default Re: Copying variables

    Hi,

    Certain properties can only be set when another property is enabled first. E.g. you cannot set the HD depth for the ringbuffer (Dynproperty HDSize) when the ringbuffer is not enabled (Dynproperty HDActive). This is visible to the user in the user interface, but not directly in the programming interface.

    Alhtough the help on the object model does show this information in many cases.

    Of course you can use a try - catch block to prevent the wizard from exiting.

    Regarding the single export, please have a look at the help for the programming interface:



    Variables.SingleExport

    SingleExport(vIndexOrName As Variant,bsFileName As String) As Boolean


    Parameters
    vIndexOrName As Variant
    Name or Index of the Variable to be exported...
    bsFileName As String
    Filename (Path) of the XML File to be created.

    ED available
    RT not used

    Remarks

    Export a single Variable to an XML File.

    Available in Version 6.51 or higher

    I hope this is helpful!
    Best regards,
    Mark

  5. #5
    Join Date
    02.04.2012
    Posts
    5

    Default Re: Copying variables

    I upgraded Zenon to 6.51 and you are right, there is such method, but I think it has some bugs because after exporting variable using SingleExport, replacing all old variable name strings with new one and importing file, I get variable connected to different driver and all subitems are deactivated. The worst thing is that ervery time when file is imported it causes showing "Import: Allocation of drivers" window, which is very annoying if you have about 1000 variables.

    Maybe I try do it by creating new variable and copying propreties, but I need to know how obtain which property is only readable and what is right order of copying them.

    This functionality is avaible in Editor so you people from COPA-DATA should know how to do it.

    Best regards

  6. #6

    Default Re: Copying variables

    Hi,

    To avoid the dialog, you can use the method "ImportDirect". See the online help for the object model for more information.

    Variables.ImportDirect


    ImportDirect(bsFileName As String,bIECDTOvw As Boolean,bUDTOvw As Boolean) As Boolean

    Also as mentioned in an earlier post, you can find information about constraints and read-only properties in the object model help.

    Regarding the XML import and changing the name, care has to be taken. When you replace too many entries, you may end up with an invalid XML file.

    To find out what you need to replace, create a copy of the variable you want to copy in the zenon editor, export the original variable an the copy of the variable both in XML, and compare the two XML files.

    Best regards,
    Mark

  7. #7
    Join Date
    30.05.2007
    Location
    Salzburg
    Posts
    879

    Default AW: Copying variables

    just for information: copying variables via the zenon API will be available in a future version of zenon (there exists already a requirement on this) - by now only functions and screens can be copied via the zenon API.

    regards,
    herbert

  8. #8
    Join Date
    29.07.2007
    Location
    Germany
    Posts
    192

    Default AW: Copying variables

    Quote Originally Posted by herberto View Post
    just for information: copying variables via the zenon API will be available in a future version of zenon ...
    Hi,

    looking for a way to copy Variables in VSTA (zenon 7.11), method still not available???

    Regards, HP
    string zenon = "7.60 Build61612 / 8.00 Build62073/ 8.10 Build62573";
    string Windows = "7 / 10 / 2016";
    string VMware = "Workstation / VMware ESXi";

  9. #9
    Join Date
    20.08.2009
    Posts
    293

    Default AW: Copying variables

    Hi,

    no, the only way to do it is via XML Export - Manipulation - Import.

    Should not be a big issue as there are a lot of XML manipulation possibilties in .NET.

    Regards,
    Bernhard

  10. #10
    Join Date
    29.07.2007
    Location
    Germany
    Posts
    192

    Default AW: Copying variables

    Quote Originally Posted by bernhardf View Post
    ...
    no, the only way to do it is via XML Export - Manipulation - Import.
    ...
    OK, thanx for the information.

    HP
    string zenon = "7.60 Build61612 / 8.00 Build62073/ 8.10 Build62573";
    string Windows = "7 / 10 / 2016";
    string VMware = "Workstation / VMware ESXi";

Similar Threads

  1. Copying variables
    By joulz in forum zenon Supervisor
    Replies: 2
    Last Post: 18th November 2008, 10:34
  2. PLC Variables and Internal Variables
    By madphilly in forum Drivers
    Replies: 1
    Last Post: 4th June 2008, 06:59

Posting Rules

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