queryTagHistory() not returning results when using project default tag provider

Hi all,

I'm working on an Ignition 8.x project and ran into an odd behavior when querying tag history.

Setup:

  • Tag provider: my_project
  • History provider (database): my_project_Hist
  • I also have another provider: my_proj (used for some test tags)

In my project properties, the default tag provider is set to my_project, and the default database is also my_project.

Observed behavior:
When I run:
system.tag.queryTagHistory(paths=['[my_project]test'], startDate=..., endDate=...)
→ returns no data.

But if I run:
system.tag.queryTagHistory(paths=['[my_project_Hist]test'], startDate=..., endDate=...)
→ it works correctly.

Interestingly, if I use tags under the other provider (my_proj), and those are historized to the same history provider (my_project_Hist), the query works fine — no issues.

So it seems that when the project’s default provider is used, queryTagHistory() doesn’t automatically resolve the link between the tag provider and the history provider, even though the history provider and database are configured correctly. When I explicitly use [my_project_Hist] it works.

I also noticed that the system.tag.queryTagHistory() documentation doesn’t list a historyProvider argument, so I want to confirm:

  • Is this expected behavior when using a project’s default tag provider?
  • Should Ignition automatically use the default history provider in this case?
  • Or is it required to always specify [<history provider>] or the full histprov: syntax?

Thanks in Advance😊!

1 Like

Reading this:

In my project properties, the default tag provider is set to my_project , and the default database is also my_project

From the docs @ Configuring Realtime Providers that might be related:

When setting up your Realtime Tag Provider, naming your Provider the same name as the database connection is not recommended. Doing so may cause no values to be returned when querying Tag data.

Further:

Where are you running this code from? Would you mind sharing your end-goal with your tag query? Display data in a trend (which component)? Build a report?

@Chris_Bingham Thanks for the clarification!

To answer your questions:

  • I’m running the query from button onclick (for data validation / export).
  • The end goal is to retrieve historical values programmatically.

Excellent. Let us know if renaming of your database connection fixes the issue.