3 Replies Latest reply on Nov 16, 2017 9:25 PM by TEL1

    Clear DataLink cache with VBA code?

    MaxStrueverWipro

      Hi,

      I was realizing there must be a cache that PI datalink uses for AF data (for non-pi-point attributes) and had been closing and reopening Excel to get the latest values (I am testing some things and changing values  in attributes without a data reference frequently and need to see them updated).

      I just found the "clear cache" button in PI DataLink > Settings, which is great!

       

      just curious, is there anyway in our own custom VBA code that we can access the Clear Cache function from within PI DataLink's functions?

      '
      Sub customFunc()
          'Clear cache for datalink before doing work??
      
           'PIDatalink.ClearCache() ??
      
          'perform calculations on super fresh data
           dim answer as integer
      End Sub
      

       

      I'm guessing no but it would be a nice-to-have

       

      thanks!

        • Re: Clear DataLink cache with VBA code?
          wehrich

          Hi Max,

           

          I was looking through some past Tech Support cases and saw that the clear cache function is not exposed with VBA.

          You could try disabling the cache by modifying the AFSDK.config file, located in the %programdata%\OSIsoft\AF directory.

          In particular you can change the line

           

          <Cache maxObjects="10000" time="120" />

           

          to

           

          <Cache maxObjects="0" time="120" />

           

          Thanks,

          Will

          2 of 2 people found this helpful