Icon visible in perspective

I created a memory tag and assigned a value as 2. And added a icon component in view. If i change the value to 1 icon should not visible. Then again i change the value to 2 after 5 mins the icon should visible how can i do this? Can u explain it clearly? Where should i bind the value to the property and condition for the script in perspective?

Hello. I have a doubt in icon visibility. Created a memory tag and assigned a value as 2. Added a icon in view. If i change the value to 1 thr icon should disable. Again if i change the value to 2 after 5 mins the icon should visible. How it is possible? Can u please explain step by stepy

You control the icon's visibility using the META.visible property in the Perspective Property Editor.

I'm offering a very simple solution1 which looks at your memory tag's timestamp which is the time at which the value last changed.

First step: make the icon appear 3 s after the memory tag value changes. I'm using tag IntMemory.

  • Select the icon and find the META.visible property in the Perspective Property Editor.
  • Click in the left gutter and add an Expression Binding (using your tag name instead of IntMemory).
now(1000) - {[default]IntMemory.Timestamp} > 3000  // ms.
  • Apply that binding and test. If you change your memory tag the icon should disappear and return in 3 s. Notes:
  • That the expression just returns a true or false for the visible property.
  • The 1000 in now() makes the function re-evaluate every 1000 ms.

Second step: modify so that it only appears when IntMemory = 2.
Change the expression to,

{[default]IntMemory} = 2
&&
now(1000) - {[default]IntMemory.Timestamp} > 3000  // ms.

1 This method will be suitable for many applications but be aware that anything that resets timestamps (gateway restart or OPC server and possibly PLC) will update the timestamp and, in this example, the component will be invisible until the timer resets. A more robust solution would require creating a tag of type DateTime to store the time of the tag value change.

Double posting is against this forum's rules. I moved your repeat here.

It is also inappropriate to ping or otherwise try to gain additional attention very soon after a post. This a a forum of volunteers, with volunteer time-frames for responses. Wait at least a day, or more on weekends.

{ I also changed the category to Ignition. Choosing an appropriate category for a topic helps get the right eyes on your question. Choosing a good tag is not enough. }

2 Likes

This is actually your third question on the topic which I didn't realise when I answered and you already have an answer to the first that gave you some good clues how to solve the problem.

There is a pencil icon below each of your questions to allow you to edit a post. Please do this to improve a question rather than post a nearly identical one.

1 Like

Probably want < 3000. Whoops. No. Use > 300000 for five minutes of invisibility.

I know - I mentioned 3 s in the post. I'm just not going to wait 5 minutes to debug my code!

4 Likes

I don't understand what you have written. Please edit the post and add punctuation so that I know where each sentence starts and ends. Then explain how this is related to the original question.

1 Like