I am getting to know AF SDK better now. I have a question about using AFAttribute.FindAttrubtesByPath(paths, db);, for the paths list, can I use something like "path\\to\\my\\*|Events"
thanks a lot!
Hi Li Luo,
AFAttribute.FindAttributeByPath takes in an array of string paths to attributes. It then returns back an AFAttributeList with all the attributes that match those paths. The string paths passed will not understand any kind of wildcarding.
The paths should have the form: \\AFserver\DB\Element|Attribute
Relative paths are supported though. So if you pass an element into the relativeFrom argument, then a syntax of .|Attribute will also work.
just tried with path\\to\\my\\.|Events, instead of *, didn't work :(
i tried "path\\to\\my\\Elements[@Name='*']|Events", however it only return the first element from my AF tree. Any ideas?
Try using the AFAttribute.FindAttributes method instead.
Thanks a lot. FindAttributes Method worked.
I am having another issue where when I tried to deploy this to the IIS, it won't make connection to PI Server. When I tried to deploy the application I am building, I am getting "An existing connection was forcibly closed by the remote host " error. However when I debug it from iisexpress under visual studio, everything works fine, meaning I can connect to PI server.
so when i look at the PI message log I found things like
[Server] PHIQAS5PI01 [Collective] phixxx8xxpi01 [ID] 7079 [Time] 7/7/2014 2:44:08 PM [Program] pinetmgr [Priority] 10 [ProcessOSUser] SYSTEM [ProcessID] 2128 [Severity] Information [Source1] Connection Information
Disconnected ID: 23292 ; Process name: Accepting TCP/IP Connection, waiting for protocol version ; User: ; OS User: ; Hostname: ; IP: 184.108.40.206 ; AppID: ; AppName:
Hello Li Luo,
The issue you are experiencing is likely a security issue. With Visual Studio, you are executing your application with your user credentials. IIS executes your application using the identity specified for the application pool (IIS Manager -> Advanced Settings -> Process Model -> Identity). You may want to create a service account on your domain, set the application pool to this identity, create a mapping on the PI Data Archive and set up AF security within PI System explorer. For testing purpose, you can try setting up the application pool with your domain account.
If one issue is resolved and you experience another one, please consider opening a new thread. This way we get a better visibility inside the forums.
The path syntax is described in the AFSDK help file under 'AF SDK Reference\Path Syntax Overview'. You are wanting to use a filter expression by specifying a '*', therefore you would need to use a syntax similar to the following: "path\\to\\my\\Elements[@Name='*']|Events".
Retrieving data ...