Applies To:
  • CitectSCADA 3.xx, 4.xx, 5.xx, 6.xx, 7.xx
  • CitectHMI 3.xx, 4.xx, 5.xx, 6.xx, 7.xx

Summary:
1) When I display my trend page it looks fine but I get a hardware alarm "Bad handle - Trendpage AN123" error. Can you help me resolve this?
2) When using TrnGetPenComment(AN, pen) on my trend page I get the hardware alarm "Invalid Argument Passed TrnGetComment"

Solution:
1) You are running cicode that requires the trend graph (which is at animation point 123) to be loaded. This can occur because your code runs concurrently with the loading of the page.

To workaround this you can call cicode that waits for a few page refreshes to ensure the graph is loaded

eg try 'IF PageInfo(7) = "3" THEN...'

For Page Entry Events you can test if the graph is loaded (or you could simply delay by adding Sleep(seconds) at the start of your cicode.

eg
WHILE TrnGetPen(AN,Pen) = "" DO
SleepMS(250);
END

2) In this case a similar problem has arisen.  A text object using the TrnGetPenComment() function to return a string has executed before the trend genie has finished loading.  A workaround is to instead write a small function such as below to pass the trend animation number and the pen number and return the comment after say a couple of page refreshes.

STRING
FUNCTION
MyTrnGetPenComment(Int hAN, INT iPen)

IF StrToInt(PageInfo(7)) > 2 THEN //after two page refreshes
        RETURN TrnGetPenComment(hAN,iPen)
ELSE
        RETURN "";
END

END

Then your Text object would look like below.

 

Keywords:
 

Attachments