AdHoc Trend Template

The AdHoc Trend Template on the cloud is great. But it seems a number of tables need to be set up in the database to handle saved graphs, annotations, etc. Are there instructions floating around on how to set up the back end? Are they included and I’m just being dense?

The inspiration for the ad-hoc trend template was IA’s original “Click-To-Graph” collection of scripts and exported windows. The forum search has many hits on the above and on “ctg” that will give you some background. The key tables for pens, axes, and subplots basically mimic the columns that the chart customizer produces.

Never mind… The code to create the tables is in the save graph and save annotation buttons. They depend on a custom property of a couple of labels. I changed the project database and the exists custom property of the labels was inconsistent with reality. So, it works when you install it into a “clean” project.

1 Like

Hi am am having a similar issue working with the ad-hoc trend template. I have read through most of the ctg forum answers but many of them are geared towards 7.7 and earlier. I am using 7.9 and getting the error that the table sqlth_te doesn’t exist but from what I understand this was used only with the ctg. Is this something that needs to be created separately to query the DB tags? Thanks!

The sqlth_te table is automatically created by Ignition when a tag is set to record history into that database.

Ah ok thanks. Do you know if the same type of Ad-hoc chart is available for non historical SQL tags?

I need the SQL code to generate “ignition.chart_annotations” table. I just have the one for save the graf.
CREATE TABLE saved_graphs (
id INT NOT NULL AUTO_INCREMENT,
title VARCHAR(45) NOT NULL,
tagpens LONGTEXT NOT NULL,
axes LONGTEXT NOT NULL,
username VARCHAR(45) NULL,
lastmodified DATETIME NOT NULL,
PRIMARY KEY (id))

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[chart_annotations](
	[id] [int] NOT NULL,
	[penname] [nvarchar](50) NULL,
	[xvalue] [nvarchar](50) NULL,
	[yvalue] [nvarchar](50) NULL,
	[note] [nvarchar](50) NULL,
	[enteredby] [nvarchar](50) NULL,
	[lastupdated] [datetime] NULL
) ON [PRIMARY]
GO