Query attributes when given a Pipoint

Discussion created by travis.lo on May 18, 2020
Latest reply on May 27, 2020 by Rick_Davin_3.0

Hello my goal is to query attributes when given a PIpoint in a windows form application written in .NET framework with a simple GUI to display results.

1) My first question is, I see example connecting to the default pi system is there anyway to connect to a specified pisystem(ideally something along the lines of the red text instead of the blue text )?

PISystems myPISystems = new PISystems();
PISystem myPISystem = myPISystems.DefaultPISystem;
// PISystem myPISystem = myPISystems.System[comboBox1.text];
if (myPISystem == null)
throw new InvalidOperationException("Default PISystem was not found.");
AFDatabase myDB = myPISystem.Databases[comboBox2.Text];
if (myDB == null)
throw new InvalidOperationException("Database was not found.");


2) my 2nd question is how does the query work for to go all the way down to a pipoint.  The original example from AF SDK reference is in blue and the red text is similar to something I would want, which drills down from Element->child element-> AFAtribute->pi point.  Using wildcards(*) for the all fields prior to the pipoint path.


// using (var search = new AFAttributeSearch(myDB, "FindTankLevel", @"Element:{ Name:'TankElement*' } Name:'Level'"))
using (var search = new AFAttributeSearch(myDB, "searchTxt",@"Element:{Name:'*'} Name:'*' Atrribute:'*' 'searchtext'"))