Canary ODBC Client
I'm having a problem querying Canary from ODBC (even though the plant in question has a license for this). Testing the connection in ODBC Data Sources works AND I can connect and see tables in Excel or Power BI (fyi: understood that I could also use the Excel Add-In or the Web-API for Power BI).
Based on this: https://help.canarylabs.com/hc/en-us/articles/360045029794-How-to-Write-Queries-Against-the-ODBC-Connector
I think the problem may be that I need to use "openquery". I've tried that in Excel using Microsoft Query and the Canary ODBC source in Excel but I'm not sure how if I'm structuring it right or if there is another problem. Are there some more details about how to use the ODBC connection in Excel?
I tried to use something like the query in the link to get the values of a tag for a data range but didn't get that to work. The specific query I'm after today is to get the current values for all the "Machine1" tags that I have (which I am doing with the Excel Add-In fine but want to get working with ODBC as well). For example:
TSTCanary1.Machine1.ChangeProgram 3/7/2022 8:56:26 AM 10 Good
TSTCanary1.Machine1.CurrentUser 3/7/2022 8:56:26 AM Good
TSTCanary1.Machine1.ErrorExist 3/7/2022 8:56:26 AM FALSE Good
5 replies
-
Hi James Wise
The openquery syntax is solely for Micrsosoft SQL if you were to create a Linked Server. More details on that here. If you're wanting to pull data into Excel via ODBC, I would use a statement like this:
select * from currentdata where tag_name like 'TSTCanary1.Machine1.%'
You can drop this statement into the Advanced Options menu.
Hope that works for you!
-
I would check two things:
- Is the machine name 'TSTCanary1'? I assumed it was, but if not, you would need the fully qualified tagpath including the machine name and dataset if you're pulling data from the raw historian view. If you're pulling data from a virtual view you have created, you would want the full path leading up to Machine1. The '%' acts as a wildcard and will match on anything that starts with the prepended path.
- MachineName.DataSetName.BranchName.TagName
- VirtualViewName.BranchName1.BranchName2.TagName
- Is security enabled? If the tagpath is correct, it may be a security issue that is not allowing the connection. The ODBC connector makes an anonymous connection to the Views service for pulling data.
- Is the machine name 'TSTCanary1'? I assumed it was, but if not, you would need the fully qualified tagpath including the machine name and dataset if you're pulling data from the raw historian view. If you're pulling data from a virtual view you have created, you would want the full path leading up to Machine1. The '%' acts as a wildcard and will match on anything that starts with the prepended path.