5 Replies Latest reply: Nov 17, 2011 5:10 AM by Steve Dark RSS

    Dynamically change of expresions in Bar chart

    Dan-Ketil Jakobsen

      I have a sql statement looking like:

       

      LET vSQL = 'EXEC master.dbo.xp_AnalogWideHistory ' & vBatchStartTime & ', ' & vBatchStopTime & ', ' & 10000 & ', ' & vTag;

       

      Example code:

      //SQL EXEC master.dbo.xp_AnalogWideHistory '11-11-2011 07:00:00', '11-11-2011 10:00:00', 10000,'3201L50H007.PV', '3201L50H007_F.PV';

       

      Running this initiates a sql stored procedure that the three parameters vBatchStartTime, vBatchStopTime and vTag.

      the result would look like this:

       

      date_time,'3201L50H007.PV', '3201L50H007_F.PV'

      11-11-2011 07:00:00, 54,3421,63,9876

      11-11-2011 07:00:10, 54,3421,63,9876

      11-11-2011 07:00:20, 55,7880,62,1278

      11-11-2011 07:00:30, 55,3311,62,2001

      ...

       

      For the record, it shows the values for selected valve(s) between the start and stop time for a set interval of every 10 second.

       

      My problem is that I want this in a graph.

      If I create the expression from the wizard the graph shows.

      But I need it to change the expression depending on the vTag content. This can be anything from 1 to typically 10 tags.

      Default the expression is SUM([3201L50H007.PV]) and SUM([3201L50H007_F.PV')

       

      How can I set the expression so that it read something like

      SUM(vTag)

      Is this even possible?

       

      Best regards

      Dan