1. Beware of Dots in Programs

If you are writing a program that uses module or batch database objects, beware of dots (".") in your program. The line:

Set myModule = PISDK.Servers.DefaultServer.PIModuleDB.PIModules.Item(1)

Creates a Servers collection, the default Server object, a PIModuleDB object, and a PIModules collection in order to get the one item. After that line of code has passed, those objects are thrown away. This wastes time and resources. If this line is inside a loop, you are wasting a LOT of time. This example is written in Visual Basic 6, but it applies to VB.Net, C++, C#, or any other language you are using that allows dots.

Always use local variables for each object. Use globals to cache commonly used objects like the PISDK object, Server objects and Databases. Cache modules that you are going to use more than once as indicated above.

Enabling Operational Intelligence