6 Replies Latest reply on Jul 18, 2018 7:22 PM by David Hearn

    Find Elements by last modified date or recently changed/modified Elements

    gheorghe.vatui

      Using latest PI AF SDK in Powershell or .Net (not decided yet)

       

      Problem: we need to get a list of all Elements (list needs to have: path to the Element's parent + Element ID) that were changed from a predefined time up to current time.

                     we are not interested in what changed but just need to have a list of the Elements that were changed.

                   

                     Constraint1. we don't want to flag value changes (i.e. if an Attribute (static or PIPoint or some other Date Reference) changes value, we don't want to consider the Element "modified".

                                         I believe we can achieve this by not setting the Attributes as "configuration item" when building the AF Database.

       

                     Constraint2. this is more problematic. Whatever AFSDK method we end up using, that must not rely in the background on querying the FindChanges_AT AF (sql) table.

                                         this is because that table might be turned off in production systems of truncated very often.

       

                                         We were considering versions of the function:

      AFDatabase.FindChangedItems

       

      However we are concerned the function might access the FindChanges_AT which as mentioned above might not be used or will be truncated often.

      I guess this question would be for an OSI dev: does this function use the FindChanges_AT table in the background ? Does it use other tables which might be flushed periodically ?

      We are trying to reliably get the last changed Elements from an AF Server that will not use the find changes table (or truncating it very often).

      How does it then track the changes... (maybe using Sql CDC  ? our production system will have the option of using SQL CDC so that is not a concern)

       

       

      Second, if the above method is not suited, we were thinking just to search for the Element paths + ID's whose last modified date (PI Builder shows a Last modified date for each Element) is

      newer than some threshold.

      I was not able to find a direct function - was looking at :

       

      AFElement.  FindElements

       

      Can I use this method to search based on last modified date ? that will do the job for us, but I am not sure if it supports that type of call.

      Or is there any other function to search for Elements by last modified date?

       

      Note: we cannot afford searching for all Elements then sorting out those that  were changed lately because that would take too long (we have other processing to do as well inside our application)

       

      Thank you,