IMDTouchKnowledge BaseShop main store

Comparison

Switching HMI Images With an Integer Variable Value

HMI and touchscreens Published 6 min read

Short answer

Bind the integer to an N-State Lamp when one image position serves every state — it selects in integer mode by default and carries up to 256 states. When each state needs its own layout or selector values do not match content IDs, bind the variable to a Content View's content id through a Range converter. A script covers timed or conditional sequences.

On this page
  1. Which method fits the job
  2. N-State Lamp: one picture per state
  3. Content View: one content screen per picture
  4. Mapping a 0-2 selector onto content IDs 1000-1002
  5. Script route for timed sequences
  6. Test the mapping before the machine runs
  7. The decision
  8. Questions asked

An integer variable on an EcoStruxure Operator Terminal drives multiple images through three routes: bind it to an N-State Lamp, which selects its state in integer mode by default and carries up to 256 states; bind it to the content id of a Content View, through a Range converter when selector values such as 0, 1, 2 must reach content IDs such as 1000, 1001, 1002; or let a script react to the integer when the sequence needs timing or conditions of its own. For a plain status display where one image position serves every state, the lamp is the answer and needs no converter. The Content View wins when each picture needs its own layout or when the selector values cannot be renumbered to match the content IDs. The sections below compare the three, work the mapping end to end, and end with the decision for each case.

Which method fits the job #

Start from two facts: the list of values your integer can hold, and whether all pictures can share one image position or each needs its own screen layout. The integer also needs exactly one writer — machine logic, an HMI action or a script — because a picture that flickers or skips state is usually two writers disagreeing.

Method How the integer picks the picture Use it when Limit to check
N-State Lamp The integer is the object's state; each state carries its own picture One image position serves every state 256 states, stated for current versions
Content View The integer names the content screen through the content id binding Each picture needs its own layout, or selector values are not content IDs Every value the integer can hold needs a mapping
Script Logic reads the integer or a timer and changes what is shown The sequence needs timed or conditional behavior No stated state count; image memory and terminal performance

N-State Lamp: one picture per state #

The N-State Lamp is the direct route. Place it on the screen, confirm its selection mode is integer (the default), and bind the state selection to your integer variable. Each state then takes its own picture in the object properties under Shape → Basic.

Check the picture against the configured state value, not against the order in which you added the images — a correct variable binding cannot rescue a picture assigned to the wrong state. The stated capacity today is 256 states, so confirm the figure in your installed build before committing a large image set. A three-state selector uses three of them.

Decision: one image position, every state swaps in place, and the state count sits inside the lamp's limit — take the lamp and skip everything else in this article.

Content View: one content screen per picture #

When each picture needs its own layout — different text, buttons or object positions per state — give every picture its own content screen and let a Content View open them. Create one content per image, record the ID each content receives (the worked example below uses 1000, 1001 and 1002), place the picture inside its content, and check that opening each content directly shows the right picture at the right size.

Add the Content View to the operating screen and test it with a fixed content first. If a known ID does not display, the problem is the content or the view, and no binding change will fix it. Once a fixed content displays correctly, assign your integer variable to the content id property of the view.

Note what a raw binding does: a selector holding 0, 1, 2 bound directly would request contents 0, 1 and 2, not your 1000-series screens. That gap is what the converter closes.

The Range converter closes the gap #

Add a converter of type Range with one entry per selector value, then attach it to the content id binding — a converter created anywhere in the project does nothing until it is attached to that binding. A Range converter is a lookup, not arithmetic; when the number itself must be scaled into a display value instead of picking a screen, that is a different job, and how to scale a PLC integer into an HMI display value covers it.

Mapping a 0-2 selector onto content IDs 1000-1002 #

Inputs. The selector is an integer variable the machine logic writes, holding the state numbers 0, 1 and 2 — dimensionless integer values; this example uses that range. The three content screens already exist in the project with IDs 1000, 1001 and 1002, assigned when the contents were created.

Rule. A Content View displays the content whose ID equals the value bound to its content id property. Because 0, 1 and 2 are not content IDs, a Range converter must turn each selector value into exactly one destination ID.

Arithmetic. The three entries are:

  • 0 → 1000
  • 1 → 1001
  • 2 → 1002

Check the offsets: 1000 - 0 = 1000, 1001 - 1 = 1000, 1002 - 2 = 1000. The offset is a constant 1000 across all three entries, with no gaps and no selector value mapping to two destinations.

Result. Three Range entries, attached to the Content View's content id binding together with the selector variable. Selector value 0 shows content 1000, value 1 shows content 1001, and value 2 shows content 1002.

Decision. A 3-state selector sits far inside the lamp's 256-state limit, so if one image position serves all three pictures, take the N-State Lamp and skip the converter entirely. Take this Content View route when each picture needs its own layout, or when the state count passes the lamp's limit and the selector cannot be renumbered.

Script route for timed sequences #

An integer selects a picture; it does not create a sequence. If the pictures must advance on their own, something has to write the integer on a schedule. A sample project for version 3.2.SP1 demonstrated pictures changing in succession with a time-based script trigger, and the same trigger can be changed to act on your integer instead. Decide first whether the picture represents machine status, in which case it must follow the variable, or a timed sequence, in which case the trigger owns the pace.

Give the selector one owner. If machine logic, an HMI action and a script all write it, the display flickers, and no graphics setting fixes that. The script route is not tied to a stated state count; the practical limits are project resources, image sizes and target-terminal performance, so verify a long sequence on the terminal itself.

Test the mapping before the machine runs #

Exercise every valid selector value — 0, 1 and 2 in the example — by writing them from a scratch test variable, not by forcing the live machine signal, and keep the machine in a safe state while you confirm the assigned picture appears for each one. Then write one value you never mapped and watch what the terminal actually shows, so the behavior for an unexpected value is a decision rather than a surprise in production.

Test on the target terminal, not only in the editor, and confirm the selector's startup value: a fresh transfer can change what variables hold at startup — why HMI variable values reset after a project transfer explains that behavior.

The decision #

  • One image position, every state swaps in place, state count within the lamp's stated limit: N-State Lamp, integer mode, no converter.
  • Each picture needs its own layout, or the selector values differ from the content IDs: Content View with one content per picture and a Range converter attached to the content id binding.
  • The sequence must advance on time or on conditions: script, with a single writer of the integer, verified on the terminal.

Questions asked

Can the project read back which content the Content View is showing?

In EcoStruxure Operator Terminal Expert V3.2 SP2 there is no way to retrieve the ID of the content screen a Content View is displaying; the content id binding drives selection in one direction only. If logic or logging needs the displayed state, read the selector integer itself instead, because your own writes define what was requested.

Can the same integer also show and hide other objects?

Yes. Object visibility in Operator Terminal Expert can be driven by either a Bool or an Integer variable, so one selector can swap the picture through a lamp or a Content View and also raise an overlay such as a fault banner at a chosen value. Keep a single writer for the integer so the picture and the overlay cannot disagree.

What should the display do when the integer holds an unmapped value?

Decide it instead of discovering it. Either clamp the selector in the controller so out-of-range values cannot reach the terminal, or add a converter entry that maps a fault value to a dedicated fault content. Then force the fault value from a test variable and watch what the terminal actually shows before the machine runs.

Keep reading

  • Troubleshooting

    Why an HMI Edit Box Shows a Value That Was Never Set

    The number in an inline edit box is a draft, not a plant value: until the submission event runs, nothing has been written to the controller. Compare the box text with the controller readback to prove it, then move value entry into modal popups with explicit save and cancel paths and keep every overview display bound to readback.

    HMI and touchscreens

  • Explainer

    Designing HMI Screens for Clear Operator Decisions

    High performance HMI design under ANSI/ISA-101.01-2015 makes abnormal conditions easier to spot than normal operation: normal running renders flat and gray, saturated color appears only on deviations, and every icon, font and color follows one documented project style. Verify the style mechanism on a single screen before scaling to the full library.

    HMI and touchscreens

  • Troubleshooting

    Fixing Goto Display Buttons Locked by HMI Global Connections

    While the Global Connections remote display number is active — its DINT tag still holding 21 — FactoryTalk View ME disables every other form of navigation, so Goto Display buttons stay dead whether or not the popup is visible. Write 21 with a one-shot on bit A and let a startup macro on display 21 reset the tag to 0; the popup stays up and the buttons respond.

    HMI and touchscreens