Alarm Custom1 property string data fails to display on graphics page.

Hello.

In my project I want some static alarm property information to be displayed on graphics pages.
Our static information is written as strings in the alarms table fields "Alarm Desc" and "Comment" properties.
Displaying the information in the "Alarm Desc" property performs well using a string expression like "AlarmTag.Desc" on the graphics page.

For some reason, displaying the string value in the property "Comment" by putting the string expression "AlarmTag.Comment" on the graphics page fails. The error message "Some variable tags were not found" shows up. Seems that the "Comment" property is not supported for access on the graphics page.

So in order to display the information in the "Comment" field on a graphics page I tried to copy the string in this field into the "Custom1" field and put the string expression "AlarmTag.Custom1" on my graphics page but nothing appears on the graphics page at runtime. Neither information or error code, simply nothing.

Can somebody enlighten this issue?

Parents
  • Another option is to use the AlmBrowse functions to read the alarm comment. It is designed to be callable directly from graphics objects. You would have to call AlmBrowseOpen from the On Page Entry event (in the page properties). You specify to filter for the exact tag you want, then store the handle returned in a local variable or page variable. Then, call AlmBrowseFirst() to select the first (and only) result. On your graphic object, you'd call AlmBrowseGetField to read the COMMENT or ALMCOMMENT field.

    There are built in functions to calculate text width, like StrCalcWidth and StrTruncFontHnd, but they're more suited to truncating text to fit the screen than to  wrapping lines. So, here's a function I wrote for adding ^N to a text string to wrap it every so many characters.

    //Adds carriage returns to the specified text string at the specified intervals, to the nearest word. Text is truncated
    //at the max number of rows, if specified, and "..." is appended.
    //
    //Modified
    //5/11/04		E.Black		Original
    //
    //sText			Text string to wrap
    //iMaxColumns	Max number of characters per line
    //iMaxRows		Max number of rows of text (default is -1 for unlimited rows)
    //
    //Returns the text string with carriage returns is returned.
    //
    STRING
    FUNCTION
    Wrap(STRING sText, INT iMaxColumns, INT iMaxRows = -1)
    
    	STRING sOutput;
    	STRING sWord;
    	STRING sLine;
    	INT iRow = 1;
    	
    	WHILE sText <> "" DO
    		sWord = StrWord(sText);
    		
    		IF (StrLength(sLine) + StrLength(sWord) + 1) <= iMaxColumns THEN
    
    			IF sLine <> "" THEN
    				sLine = sLine + " " + sWord;
    			ELSE
    				sLine = sWord;
    			END
    
    		ELSE
    			IF iRow <> iMaxRows THEN
    
    				IF sOutput <> "" THEN
    					sOutput = sOutput + "^n" + sLine;
    				ELSE
    					sOutput = sLine;
    				END
    				
    				sLine = sWord;
    				iRow = iRow + 1;
    
    			ELSE
    
    				sOutput = sOutput + "^n" + sLine;
    				sOutput = StrLeft(sOutput, StrLength(sOutput) - 3) + "...";
    				RETURN sOutput;
    			END
    		END
    	END
    	
    	IF sLine <> "" THEN
    		IF sOutput <> "" THEN
    			sOutput = sOutput + "^n" + sLine;
    		ELSE
    			sOutput = sLine;
    		END
    	END
    	
    	RETURN sOutput;
    END
    
Reply
  • Another option is to use the AlmBrowse functions to read the alarm comment. It is designed to be callable directly from graphics objects. You would have to call AlmBrowseOpen from the On Page Entry event (in the page properties). You specify to filter for the exact tag you want, then store the handle returned in a local variable or page variable. Then, call AlmBrowseFirst() to select the first (and only) result. On your graphic object, you'd call AlmBrowseGetField to read the COMMENT or ALMCOMMENT field.

    There are built in functions to calculate text width, like StrCalcWidth and StrTruncFontHnd, but they're more suited to truncating text to fit the screen than to  wrapping lines. So, here's a function I wrote for adding ^N to a text string to wrap it every so many characters.

    //Adds carriage returns to the specified text string at the specified intervals, to the nearest word. Text is truncated
    //at the max number of rows, if specified, and "..." is appended.
    //
    //Modified
    //5/11/04		E.Black		Original
    //
    //sText			Text string to wrap
    //iMaxColumns	Max number of characters per line
    //iMaxRows		Max number of rows of text (default is -1 for unlimited rows)
    //
    //Returns the text string with carriage returns is returned.
    //
    STRING
    FUNCTION
    Wrap(STRING sText, INT iMaxColumns, INT iMaxRows = -1)
    
    	STRING sOutput;
    	STRING sWord;
    	STRING sLine;
    	INT iRow = 1;
    	
    	WHILE sText <> "" DO
    		sWord = StrWord(sText);
    		
    		IF (StrLength(sLine) + StrLength(sWord) + 1) <= iMaxColumns THEN
    
    			IF sLine <> "" THEN
    				sLine = sLine + " " + sWord;
    			ELSE
    				sLine = sWord;
    			END
    
    		ELSE
    			IF iRow <> iMaxRows THEN
    
    				IF sOutput <> "" THEN
    					sOutput = sOutput + "^n" + sLine;
    				ELSE
    					sOutput = sLine;
    				END
    				
    				sLine = sWord;
    				iRow = iRow + 1;
    
    			ELSE
    
    				sOutput = sOutput + "^n" + sLine;
    				sOutput = StrLeft(sOutput, StrLength(sOutput) - 3) + "...";
    				RETURN sOutput;
    			END
    		END
    	END
    	
    	IF sLine <> "" THEN
    		IF sOutput <> "" THEN
    			sOutput = sOutput + "^n" + sLine;
    		ELSE
    			sOutput = sLine;
    		END
    	END
    	
    	RETURN sOutput;
    END
    
Children
No Data