Calculated tags

I know that you can add like an avg of a tag onto a trend using the calculated tag… but is there a way to take multiple tags and get a sum of them and display that on a trend?

for instance, I have 3 pressures, id like to be able to take all 3 of those and add them up and have them display the sum of the pressures as a pen on a trend, which could then be compared to another tag on a trend.

this would have to be done dynamically, not something that I would have to go into the designer to do.

In the SQL tags browser
Right click\newtag\DB tag
Then on the bottom left corner use Expression/SQL

Here is one of mine that sums flow rates
{GENERATOR/LOS_COCHES_FLOW}+{DIST/BALL_PS/BALL_GRAVITY_FLOW}+{DIST_WLAN/PADRE_6/PADRE6_FLOW_MGD}

Yeah I know about doing it that way… I need something that I can do dynamically without having to build a tag for each instance. like if I could query the trend chart some kind of way and place that on a tag somehow.

Now your leaving the easy and entering the custom made area. ( Where the fun is :smiling_imp: )

Behind the scenes the graphing chart is calling system.tag.queryTagHistory
You can call this function yourself with all the source tags and then loop through the retured dataset doing the required math to create a new dataset which you then graph on a generic graphing component.

If your really adventurous, you can do something like I did here except for the tags you want. Doing it that way would allow you to put the calculation into the query so the database does the hard work. However, the system.tag.queryTagHistory function does a bunch more stuff to fill in blanks and check status and filter out bad data etc.