Expression for a progress bar if exceeds...?

Trying to create a expression for a progress bar. If exceeds 100%, I would like for the progress bar to show ???.

{[default]AZ ASRS Conveyor System/Wave Control/C7-1 BB1001A/N701:10}/{[default]AZ ASRS Conveyor System/Wave Control/C7-1 BB1001A/N701:11.value}*100
if((({Root Container.Progress Bar.value} > 100, color(255, 0, 0),
if({Root Container.Progress Bar.value} == 100, color(0, 0, 255), color(0, 255, 0)))
)
)
)

Please see Wiki - how to post code on this forum.
That allows you to post the code in a readable format as shown below. This in turn reveals some strange syntax and redundant ( ) occurrences.

{[default]AZ ASRS Conveyor System/Wave Control/C7-1 BB1001A/N701:10}
  / {[default]AZ ASRS Conveyor System/Wave Control/C7-1 BB1001A/N701:11.value} 
  * 100
  if(
      (
        ({Root Container.Progress Bar.value} > 100, 
          color(255, 0, 0),
          if({Root Container.Progress Bar.value} == 100, 
            color(0, 0, 255), 
            color(0, 255, 0)
        )
      )
    )
  )
)

Can you explain your expression logic?

This is most likely not doing what you think it does.
Can you elaborate on what you have (what data, and what its role is concerning that progress bar), and what the whole thing is supposed to look like ?

1 Like

I think it doesn't work if only use a progress bar. the work around is place a progress bar and a label overlapped in a container to make it happen.

When the value is less or equal to 100, set progress bar's visible property to true, when the value is large than 100, set label's visible property to true. (Just use expression binding for each component)

image
image
image

image
image
image

You can even make a template if you need re-use this 'combined component'.

You can and should name your ignition tags properly with words so that you can use them logically in your graphics, as well as to maintain your sanity (and the sanity of the next person who looks at the project)

Sorry, This is a bit that we use in PLC-5, Yes PLC-5...LOL. Once we upgrade it will change so I didnt want to put too much time....

Awesome Thank you.

Okay, I understand, however, when you upgrade the PLC, the Ignition tag name will not have to change, only the OPC path. Use a name that makes since for what the bits purpose is. Prior to using it throughout your program and then learning that you want to change the name and then having to manual search and rename the reference in all the places that it is used.

2 Likes