# Returning Text and Dynamic values in a String

**URL:** <https://forum.inductiveautomation.com/t/returning-text-and-dynamic-values-in-a-string/110221>\
**Category:** Ignition\
**Tags:** perspective, scripting\
**Created:** [August 27, 2025, 7:24pm UTC](https://forum.inductiveautomation.com/t/returning-text-and-dynamic-values-in-a-string/110221 "2025-08-27T19:24:17Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Carleton\_Brown](https://avatars.discourse-cdn.com/v4/letter/c/c0e974/32.png) [@Carleton\_Brown](https://forum.inductiveautomation.com/u/Carleton_Brown)\
**Post date:** [August 27, 2025, 7:24pm UTC](https://forum.inductiveautomation.com/t/returning-text-and-dynamic-values-in-a-string/110221/1 "2025-08-27T19:24:17Z")

</div>

I am trying to create a transform in a label that will display multiple strings depending on a tags value. The strings contain text and dynamic values (tags). When I search the internet, I find that the return f"" format should work to return text and dynamic values in the same string, but it does not. I'm on version 8.1.42 working in perspective. Can anyone tell me what I'm doing wrong?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/f/efb4463c8b16983ceb5c1c9fb0cc01227c1a0859.png)

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [August 27, 2025, 7:27pm UTC](https://forum.inductiveautomation.com/t/returning-text-and-dynamic-values-in-a-string/110221/2 "2025-08-27T19:27:45Z")

</div>

That's likely a Python 3 syntax. Jython is equivalent to python 2.7, so you'll need to do `string with {0} replacement.format(L1)` or `string with %0.2f replacement % L1`

---

<div class="post-metadata">

**Author:** ![code\_skin](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@code\_skin](https://forum.inductiveautomation.com/u/code_skin)\
**Post date:** [August 27, 2025, 7:28pm UTC](https://forum.inductiveautomation.com/t/returning-text-and-dynamic-values-in-a-string/110221/3 "2025-08-27T19:28:59Z")

</div>

f formatting is for Python3. Ignition uses Jython 2.7 - so you’ll need to go with %s or .format().

`return ‘The value is %s‘ %L1`

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [August 27, 2025, 7:31pm UTC](https://forum.inductiveautomation.com/t/returning-text-and-dynamic-values-in-a-string/110221/4 "2025-08-27T19:31:41Z")

</div>

Other things of note, avoid doing blocking reads in a transform. Bind the tags you want to monitor to custom properties, either on the component or the root container of the view. From there, you can reference them in an expression, no transform needed.

In general, you should be aiming to try to achieve things with only expressions, especially simple tasks such as this. Expressions are much more performant than script transforms.

an example expression would be

```python
if(
	{path.to.driver.tag} = 5,
	stringFormat(
		"the value is %0.2f", 
		{path.to.custom.prop.bound.to.tagA}
	),
	"22"

```

if you have multiple states on your driving tag, it may be better to use a `case` statement instead.

> **[Expression Functions | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/appendix/expression-functions)**
>
> The expression language is used to define dynamic values for component properties and expression tags. Expressions often involve one or more other values that are used to calculate a final value. Expressions don't do anything, other than return a...

---

<div class="post-metadata">

**Author:** ![Carleton\_Brown](https://avatars.discourse-cdn.com/v4/letter/c/c0e974/32.png) [@Carleton\_Brown](https://forum.inductiveautomation.com/u/Carleton_Brown)\
**Post date:** [August 27, 2025, 7:33pm UTC](https://forum.inductiveautomation.com/t/returning-text-and-dynamic-values-in-a-string/110221/5 "2025-08-27T19:33:00Z")

</div>

Thank you. I will try your suggestions.

---

<div class="post-metadata">

**Author:** ![Carleton\_Brown](https://avatars.discourse-cdn.com/v4/letter/c/c0e974/32.png) [@Carleton\_Brown](https://forum.inductiveautomation.com/u/Carleton_Brown)\
**Post date:** [August 27, 2025, 7:36pm UTC](https://forum.inductiveautomation.com/t/returning-text-and-dynamic-values-in-a-string/110221/6 "2025-08-27T19:36:11Z")

</div>

I tried you suggestion and it took care of the error. Thank you, but I am getting back more information than just the value. The information is coming from a PLC tag and it looks like status and a timestamp are coming back also. Any way to stop that?

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/1/a1f83d518561b15255938cf0c80fd9b6aaed8cc0.png)

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [August 27, 2025, 7:37pm UTC](https://forum.inductiveautomation.com/t/returning-text-and-dynamic-values-in-a-string/110221/7 "2025-08-27T19:37:27Z")

</div>

Use `L1[0].value`, the system function returns a list of qualified values.

> **[system.tag.readBlocking | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-tag/system-tag-readBlocking)**
>
> Reads the value of the tags at the given paths.

If you haven't already, start working through [inductive university](https://inductiveuniversity.com/). Its free and covers a lot of things, and its from inductive automation(the people who make Ignition.)

---

<div class="post-metadata">

**Author:** ![Carleton\_Brown](https://avatars.discourse-cdn.com/v4/letter/c/c0e974/32.png) [@Carleton\_Brown](https://forum.inductiveautomation.com/u/Carleton_Brown)\
**Post date:** [August 27, 2025, 7:38pm UTC](https://forum.inductiveautomation.com/t/returning-text-and-dynamic-values-in-a-string/110221/8 "2025-08-27T19:38:30Z")

</div>

Thank you Ryan, that worked!
