---
title: "Discussion on \"Query and Visualise AVEVA Historian on Grafana Dashboard\" | Hashnode"
description: "Discussion on \"Query and Visualise AVEVA Historian on Grafana Dashboard\". How to query AVEVA Wonderware Historian from 3rd party applications"
url: "https://hashnode.com/posts/query-and-visualise-aveva-historian-on-grafana-dashboard/6146742ea2b54e17a52c3094"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Query and Visualise AVEVA Historian on Grafana Dashboard](https://billliu.hashnode.dev/query-and-visualise-aveva-historian-on-grafana-dashboard?utm_source=hashnode&utm_medium=feed)

How to query AVEVA Wonderware Historian from 3rd party applications

Sep 18, 2021 · 3 min read · billliu.hashnode.dev  
Read the article

-   [#dashboard](https://hashnode.com/tag/dashboard)

## Written by

[Bill Liu](https://hashnode.com/@lpc921)

@lpc921 · New Zealand

  
[View profile](https://hashnode.com/@lpc921)

Industry 4.0, IIoT

## Responses 2

Markdown supported · ⌘↵ to post

[Melvict Melbourne](https://hashnode.com/@Melvict)

[Feb 23, 2024](https://hashnode.com/posts/query-and-visualise-aveva-historian-on-grafana-dashboard/6146742ea2b54e17a52c3094/comment/65d84bccba3d78c9706c8f14)

Hi Bill,

I'm interested in how to read data with the Rest API into Grafana. How do I configure the OData Plugin to use NTLM?

[Olivier Suc, PMP](https://hashnode.com/@oliviergsuc)

[Apr 29, 2022](https://hashnode.com/posts/query-and-visualise-aveva-historian-on-grafana-dashboard/6146742ea2b54e17a52c3094/comment/626c6616a2d355d4df43d495)

Bill, great tutorial. I've managed to get the trend to work but I'm having an issue with the taglist. I get an error after copying your code verbatim (upper right hand corner copy option). I'm using Wonderware 2014 R2 SP1 P2 and Grafana 8.4.5 i'm getting "db query error: mssql: Incorrect syntax near ')'. "

[Bill Liu](https://hashnode.com/@lpc921)

[Apr 30, 2022](https://hashnode.com/posts/query-and-visualise-aveva-historian-on-grafana-dashboard/6146742ea2b54e17a52c3094/comment/626c6616a2d355d4df43d495#reply-626c83e4a2d355d4df43d6e8)

Hi Olivier, thanks for your comment. I would find the exact query that Grafana sends to MSSQL. You can either do it in Grafana using the "Query Inspector", or get the query history from MSSQL server. This might be an issue with Grafana templating.

[Olivier Suc, PMP](https://hashnode.com/@oliviergsuc)

[Apr 30, 2022](https://hashnode.com/posts/query-and-visualise-aveva-historian-on-grafana-dashboard/6146742ea2b54e17a52c3094/comment/626c6616a2d355d4df43d495#reply-626c8f36b7dcabd258e756a1)

[Bill Liu](https://hashnode.com/@lpc921) DECLARE @TSQL varchar(8000), @DATE\_FROM char(19), @DATE\_TO char(19)

SELECT @DATE\_FROM = REPLACE('2022-04-28T01:07:35Z', 'T', ' ') SELECT @DATE\_TO = REPLACE('2022-04-30T01:07:35Z', 'T', ' ') SELECT @TSQL = ' SELECT DateTime AS time, K12-1STAT.CPV,K12-2STAT.CPV,K12-3STAT.CPV,K12-4STAT.CPV,K12-5STAT.CPV,K12-6STAT.CPV FROM OPENQUERY( INSQL, '' SELECT DateTime, K12-1STAT.CPV,K12-2STAT.CPV,K12-3STAT.CPV,K12-4STAT.CPV,K12-5STAT.CPV,K12-6STAT.CPV FROM Runtime.dbo.WideHistory WHERE wwResolution = 120000 AND wwRetrievalMode = "Average" AND DateTime >= ''''' + @DATE\_FROM + ''''' AND DateTime <= ''''' + @DATE\_TO + ''''' AND wwTimeZone = ''''UTC'''' ORDER BY DateTime ASC '') ' EXEC (@TSQL)

error: " db query error: mssql: Incorrect syntax near '.'. "

I dont see the '.'. anywhere
