AnsweredAssumed Answered

Event trigger of PI analyses is not updating correctly PI TAG value according a resultset of table link

Question asked by Lowreno on Nov 19, 2015
Latest reply on Nov 27, 2015 by Lowreno

Dear colleagues,

 

      So, i am having a problem to update a PI point  based on a resultset of a table link accessing a PostGreSQL.

      Basically, I have two situations where the first one, I have success and the second one, the values are just updated with the same value. Both are using the same architecture/idea (it means, same odbc connection, same Template, etc...). The "big" difference between cases is that:

 

      The first one is running the following SQL into PostGre:

      The second one is running:    

 

     As a "test" (which is returning a simple dataset), the function "CalcVazaoVertida" inside PostGreSQL is listed below:

 

CREATE OR REPLACE FUNCTION CalcVazaoVertida(pIdReservoir int, pNaguaValue numeric)

RETURNS TABLE(reservoirid bigint, valueoverflow numeric) AS

$$

BEGIN

   DROP TABLE IF EXISTS T_RETURN;

   CREATE TEMP TABLE T_RETURN(reservoirid bigint, valueoverflow numeric);

   INSERT INTO T_RETURN VALUES (pIdReservoir, date_part('second', current_time));  --just for test purposes...

 

   RETURN QUERY SELECT * FROM T_RETURN;    

END;

$$

    LANGUAGE plpgsql;

 

    The result set are two fields and just one row:  The reservoirid and the seconds of 'current_time' in double value as shown below:

 

    Below, I'm listing much more details between the cases where: the first one is FINE, and the second one is not updating the PI Point as expected:

 

 

     Please, if someone have any idea WHY i am running into this problem and have wonderful  tips to solve it, I'll be very happy ;-)

     If needed, I can provide more details...

 

     Thanks in advance,

 

Lowreno.

Outcomes