Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to retrieve data when providing a PI tag name directly #502

Closed
alexjj opened this issue Jan 10, 2020 · 2 comments
Closed

How to retrieve data when providing a PI tag name directly #502

alexjj opened this issue Jan 10, 2020 · 2 comments

Comments

@alexjj
Copy link

alexjj commented Jan 10, 2020

Feature request

Abstract

The documentation uses points = server.search('*')[0] to get a PI tag to then retrieve data in various ways. It would be good to add an example that shows how the user can provide a tag with a name they already know e.g. my_pi_tag.pv

Motivation and summary

I generally think it's a common occurrence for the user to already know the name of tags they want to retrieve data for.

Suggested solution

I can use the search function to do it e.g. points = server.search('my_pi_tag.pv')[0] but perhaps something like this would be of use:

with PI.PIServer() as server:
    tag = server.get_tag('my_pi_tag.pv')
    data = tag.recorded_values('*-48h', '*')
    print(data)
@alexjj alexjj changed the title Documentation: How to provide PI tag name How to retrieve data when providing a PI tag name directly Jan 10, 2020
@Hugovdberg
Copy link
Owner

Thanks for the suggestion. I was actually thinking about adding a new keyword argument simplify to the server.search method. That would return a single point if the point name was specified exactly, while returning a list of points if necessary.
It is also related to #74, where the returned list would allow you to extract data directly from multiple points. This could possibly negate the need for the simplify argument on the search method.

@Hugovdberg
Copy link
Owner

Closing this issue to merge it with #74.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants