Anyway to Export / Import Project Database (Variables /Tags)

Is there a way to do this?

I don’t mean exporting/importing charts. I want to be able to create tags off-line and import them in to an existing or a new project.

Anyway to do that with PacControl?

Thanks.

1 Like

http://www.opto22.com/community/showthread.php?t=235

BTW, I found this by typing this into Google “excel site:opto22.com/community”

Short answer is, no, not yet.

Thanks Ben.

I saw from the link that this question was asked back in 2012. It is almost 2016 and Opto22 still does not have this basic functionality. Every single piece of control Automation software that I have come across in the past had this basic feature. Does OPTO22’s software group have any plans to implement this option in the near future? Or at the very least, create some sort of a utility that can do this? I am surprised that lot more people are not SCREAMING for this or that Opto22 has not made this a priority.

Could you help us out here by giving a little more detail about your needs/expectations? (Perhaps an example of a use case?) We do let you Import/Export your I/O Units, by way of the (text) OTG, have you looked at those files at all?

Hi Skyfox… I second what Mary said… It get’s requested about once every 3 to 5 years, so its hard for us to build a case for the engineers to spend time building it…
Help us help you, what are your needs and expectations?

Well this is sooner than the 3 years, but thought i would take a crack at this anyways. I think the reason for this is that people find out they can’t do this and just deal with it. But someone gets frustrated enough that they search for help only to come up short. Or like me, finds a forum referring to the exact topic I need help with and finds posts like these. I would think that the topic name is pretty self explanatory.

We have a case where we have to enter a bunch of variables that are identical in size but have different names. i.e. 80 lift stations. It appears that the only way to achieve this is to create each variable one at a time. Another way is to open another project, create the variables, reference them in a block, then copy that block to your working project. This however doesn’t bring over the persistent attribute, nor does it show in the variable list until you save, close then reopen project (this was 9.4 but shows in list in 9.6).

In another example, Rockwell software has allowed this functionality ever since i have started with PLCs (2003). The software exports the tags into a CSV file. You can then open in excel or notepad. You copy an existing tag, paste it, then modify tag name. This is where excel shines as you can “fill” cells with auto-number increment.

I understand that Opto likes to keep it costs down, especially on software development, and its hard to keep up with companies like Rockwell, Siemens, GE, etc… that have near unlimited resources. But this functionality is a basic tool to boost productivity when creating code.

If further explanation or clarification on what exporting/importing tags (variables) is, i can make a short video using Rockwell software showing exporting, modifying, then importing.

I have looked at the OTG referenced by mstjohn, but this is only good for IO points.

2 Likes

There is a command line argument in 9.6 that you can pass a file with variable names and types and they will be added to the strategy - Look for “Using PAC Control’s Command-Line Interface Tool”. Prior to having this, I wrote an autohotkey script that will take a list of variables from a csv file and add them to the open strategy.

See Add Vars via Command Line Interface and Teamwork Strategies - #9 by philip

I do think it would be nice to be able to export all your variables to a csv, be able to edit them and re-import them built-in, maybe someday…

1 Like

I totally agree with you Mark, do not understand why some of the most important features get ignored while some nice but not so important features get added…I had been suggesting about this one back at least 12 years ago. Beno, sometimes people just get tired of asking so they drop it.

However, they did go ahead an put this in about a year or so ago. It works fine once you’ve gotten used to it. You can make a batch file to load the csv file you create or you can just save a CLI text and copy it to your command prompt. Once it is in the command prompt, you can just keep using it with up arrow. Here is the command prompt text I used as an example, “C:\Users\barrett\Documents\Peco Facet\ Control\Cold Room.idb” /f “C:\Users\barrett\Documents\Peco Facet\CLI_Batch.txt”. I put this in a readme notepad file so I can reuse it.

I named the CSV file “CLI_Batch.txt” and I opened an Excel sheet and created the names, then using the text concatenation in Excel I added all the text pieces together to get "/av UPTMR_VAR;Load_LoadValveTimer;“Valve Operation Alarm Timer”;ON_RUN;0 for each line of each variable I need. Then I copy and paste into the batch file and run the cli. For the most part, you only have to modify this line for the various variable types.

To search for this, search “cli” in the users manual. It’s kinda like they unintentionally buried it. If you search for “command” or “line” you will not find it…the docs cover it pretty well. Look in the docs to determine what changes you need to make for the specific variable type.

Btw, in case you are not aware, yes I asked for this too years ago but I guess everyone else just started using this method for adding large numbers of IO variables. Add a few IO tags of the type you need, and then export the tag base by right clicking and pick “Export…” on “I/O Units” in the tree. Next, open that file with Excel and parse it with headers and commas. Now you have a file with all the OTG tags in it based on the rack they reside on.

Edit this file by adding all the names you need while maintaining the column data that is there. It is easiest to do this one type at a time, i.e; discreet in, discreet out, etc.
Keep in mind you have to keep all the module channel numbers correct and the module position correct based on the module type 4ch, 8ch, etc. The point number sequence doesn’t seem to matter because I think it overwrites them anyway. Also, the sequence number is treated by Pac Control as 4 point modules or something, not sure what the issue there is, but doesn’t seem to matter.

Once you are done with the edit, then save the excel file as a CSV file, if not it will not import. Next, change the file name to *.OTG, then import it just like you exported it. I typically save the strategy and the OTG file in case something gets hosed up, I can delete it and start over again without starting over from beginning. It sounds like a real headache but it’s not too bad and you can add a rack full of 32 point modules in an hour instead of all day. The other major reason to do this is spelling accuracy and the ability to create a series of scripts for loading each variable from the RackX_fTable you use to get the rack. Unless I am going to use tables only, I do this at top of Main Loop.

Using the aforementioned method you can also use the RackX_fTable to set up a write by exception for the whole strategy. To do this, only script the input vars at the top of strategy, then use the output vars in the process throughout, then at the end of the chart, script the output vars with the RackX_fTable values and compare each one to see if you need to write it. Once you create the script ON ONE LINE, it will be easy to do all of them. By using this method, the strategy only has to write the vars that have changed and it does all the compare internally, so it is still faster then writing the whole block of outputs every time.

1 Like

Philip and Barret, thank you for this. It is cumbersome, but works. Thanks again.

I tried to read all the posts, but has anybody tried to open the idb.txt text file, and copy and paste the tag data area into another notepad document, save as .csv and it opens in Excel? I just did it, and it works for exporting the tag data (kind of) since the tag definition section is comma delimited.
I don’t plan on testing modifying that tag definition section to “import” via a comma delimited list. Not exactly excel but it’s somewhat simple.

Edit: I tried the modifying the idb.txt file, and it didn’t work, the project wouldn’t open. I had to make an action block that just had a move 0 into x tag, for EVERY TAG, then copy and paste that into the new project and it imports the tags.

This functionality greatly limits two people from working on a project together, so I’m guessing whoever finds out this limitation doesn’t make a forum post complaining, they just use another solution.

I’ve been asking for this feature since the FactoryFloor days. The ability to import new tags via CLI is a step forward, but falls far short of the basic task of exporting the tag database, editing existing tagnames, and then importing it. If you have a strategy built that has 100s of tags that need to be changed (for whatever reason), you have to individually open each one, change it, and then save it. It’s a huge pain. You can import a bunch of new tags via the CLI and a batch file, but you would still have to go into the strategy and do a find/replace with every the existing tag and the new one. You might as well just change them individually at that point.

I actually made a Excel Macro to use PAC Control CLI command to add variable to strategy:

As you can see we have few machines, and these machine needs same tag name. It is tedious to add one by one…

I will port this to my personal excel file, and share with you guys this weekends…

There seems to be a PAC Control bug though… After the variables are created using CLI, and you download strategy to controller, it will corrupt your controller strategy.
-------- The work around is, you need to double click each variable created using CLI, and press ok.
“hope someone can verify this bug on their end”

Here is the command syntax (search for CLI on user guide):

c:\<CLI executable program> <strategy filename> /av <variable type>;<variable name>;<description>;<initialization type>;<initial value>[;<string width>][;<table length>]