Adding DB pens to Easy chart issue

Im using the AdHoc easy chart and dynamically adding pens to the dataset through a button script. The script adds the pens and i am able to see them in the table and in the easy chart configuration but i get the following SQL error. Also when i open the chart customizer and run the diagnostics on the new tag it has no errors and the tag added through the script appears the same as tags not added through the script. Not sure whats going on… Thanks in advance

“SQLQuery(query=SELECT t_stamp, TCA1 FROM Tower_C WHERE t_stamp >= ? AND t_stamp <= ? AND ORDER BY t_stamp, database=MFG_Controls)@0ms
On: AdHoc Trend.AdHoc Trend.Easy Chart
caused by GatewayException: Incorrect syntax near the keyword ‘ORDER’.
caused by SQLServerException: Incorrect syntax near the keyword ‘ORDER’.”

Altering the Dataset script:

chart = event.source.parent.getComponent('Easy Chart').pens
newRow = [tag, tag, tbl, "t_stamp","MFG_Controls", "Default Axis", 1, 1, "0,0,255", 1, 1, 1, 0, 1, 0," "," ",0,0,0,1," ",0]
chart = system.dataset.addRow(chart, newRow)
event.source.parent.getComponent('Easy Chart').pens = chart


Looks like you are supplying a space for a where clause–it should be an empty string.

1 Like

Wow, thanks i should have caught that. Works perfect now.