# Formatting number with space placeholder in expression

**URL:** <https://forum.inductiveautomation.com/t/formatting-number-with-space-placeholder-in-expression/51196>\
**Category:** Ignition\
**Created:** [September 21, 2021, 3:42pm UTC](https://forum.inductiveautomation.com/t/formatting-number-with-space-placeholder-in-expression/51196 "2021-09-21T15:42:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yburdak](https://avatars.discourse-cdn.com/v4/letter/y/ccd318/32.png) [@yburdak](https://forum.inductiveautomation.com/u/yburdak)\
**Post date:** [September 21, 2021, 3:42pm UTC](https://forum.inductiveautomation.com/t/formatting-number-with-space-placeholder-in-expression/51196/1 "2021-09-21T15:42:30Z")

</div>

I am attempting to format a combination of text and number to be displayed in a label but with white space placeholders instead of leading zeroes.  
Example: “Flow: " + numberFormat(tag(”[default]/Flow"), “##0.00”).  
From the example above the output can be:  
Flow: 5.2  
Flow: 10.5  
Flow 107.1  
I can obviously set a pattern to include leading zeroes but I would like to “reserve” the space instead so the output would look something like this with underscores replaced by spaces:  
Flow: \_\_5.2  
Flow: \_10.5  
Flow 107.1  
I can easily do that in scripting but would like to avoid it for something as simple as text formatting.  
For the sake of discussion I am assuming a monospaced font.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 21, 2021, 3:53pm UTC](https://forum.inductiveautomation.com/t/formatting-number-with-space-placeholder-in-expression/51196/2 "2021-09-21T15:53:32Z")

</div>

Try stringFormat instead, like so:

```auto
stringFormat("Flow: %6.2f", {[default]Flow})

```

And you really should avoid the tag() expression function in UIs.

---

<div class="post-metadata">

**Author:** ![yburdak](https://avatars.discourse-cdn.com/v4/letter/y/ccd318/32.png) [@yburdak](https://forum.inductiveautomation.com/u/yburdak)\
**Post date:** [September 21, 2021, 4:41pm UTC](https://forum.inductiveautomation.com/t/formatting-number-with-space-placeholder-in-expression/51196/3 "2021-09-21T16:41:31Z")

</div>

Thanks, that works. I noticed it doesn’t quite work with the default Dialog font but as long as I pick anything that is monospaced such as Courier New or Consolas it works great.  
The tag() expression was leftover from my simplification of the original expression. What is the problem with using tag() in UI bindings? How would I handle indirect addressing in the example above if I had multiple different flow tags?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 21, 2021, 4:47pm UTC](https://forum.inductiveautomation.com/t/formatting-number-with-space-placeholder-in-expression/51196/4 "2021-09-21T16:47:17Z")

</div>

Start here:

> [@Expression into Indirect Tag Binding](https://forum.inductiveautomation.com/t/expression-into-indirect-tag-binding/42584):
>
> Hi all, I have Line Component in a Template which I would use the Visible Property depending of a two tag where path changes dynamically. Planning to use an expression like: Visible if {…/TTP01/…} AND {…/PPT01/…} where TTP and PPT are between 01 to 20 I tried to use Indirect Tag Binding, but this doesn’t allow me to have more than one tag. Another solution was to use Expression Binding, but this doesn’t allow me to have dynamic reference or I don’t know how. How to solve it? thank you for…
