Add variables in bulk

Is there a way to add variables in bulk in PAC Control?
Once again referencing my PLC background, most PLCs I’ve used allowed you to export your variable/tag database, usually as a CSV file, which you could then edit in Excel and import back in.
I do this all the time because on large projects, I might have to add tags for say 100 drives, each drive would have 30-40 tags. And as long as I had a proper tag structure, I could add tags for one drive, and just copy and replace the drive number for the rest of the drives.
I can’t seem to be able to do anything like this in PAC Control since we are advised not to edit the idb.txt file manually?

Hi Koganei,

The idb.txt contents impact [I]groov[/I] but not PAC Control (which uses the .idb binary file).

By tags, do you mean non-I/O tags?

I’m hoping you could use tables to save yourself a lot of variables and redundant code, as I mentioned in this post.

For example, let’s say those 30-40 tags per drive might be:
nOnFlag, nVoltageLevel, nSerialNumber, etc. (just making this up) and you’re thinking you’d add:
nOnFlag1, nOnFlag2… nOnFlag100; nVoltageLevel1, nVoltageLevel2, etc.

If instead you changed each of these 30-40 tags into a table (where each element/index would correspond to a particular drive), when you’d instead have:
ntOnFlags, ntVoltageLevels, ntSerialNumbers and your tags would be in the 30-40 range instead of the 3,000 - 4,000 range. Much easier to manage. Also easier to expand when you go from today’s 100 drives to tomorrow’s 10,000 drives.

Do you see what I’m saying here?


Yes, that makes sense.
Follow-up question: If I wanted to use names to index my tables instead of just numbers, i.e., instead of just ntOnFlags[1], ntOnFlags[2], I create numeric variables nPump1, nPump2, etc. and use ntOnFlags[nPump1], would be it best to initialise the variables on download, on run, or make them persistent? Or leave all the initial values to 0 and use an OptoScript block to initialise them in the Powerup chart (which I would actually have to do if they were persistent since you can’t initialise persistent variables)?

A couple thoughts on this, if you’re going to initialize this values (and you have lots) to, say:
nPump1 = 1;
nPump2 = 2;

nPump100 = 100;
Then you’re probably better off skipping it, since you’re (I’m guessing) not going to CHANGE those values, and well, not getting any (pardon the pun) [I]value [/I]out of having them as variables… you’re just adding more variables. At the point, you also lose the value of having a table and the ability to loop through (if you were to change them to something other than 1, 2, 3…).

Here’s another post about initializing tables and persistence that I hope might be helpful to you: [click here].