# Repeater template number format

**URL:** <https://forum.inductiveautomation.com/t/repeater-template-number-format/79522>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [September 22, 2023, 6:38pm UTC](https://forum.inductiveautomation.com/t/repeater-template-number-format/79522 "2023-09-22T18:38:11Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![hw79](https://avatars.discourse-cdn.com/v4/letter/h/838e76/32.png) [@hw79](https://forum.inductiveautomation.com/u/hw79)\
**Post date:** [September 22, 2023, 6:38pm UTC](https://forum.inductiveautomation.com/t/repeater-template-number-format/79522/1 "2023-09-22T18:38:11Z")

</div>

I have a repeater template set up to repeat a list of numbers from my table. The numbers have 3 decimal places, but when I try to configure the transform for numeric, the format pattern is greyed out and I get an error on the template because the binding is to a param and it's currently returning 'value' instead of a number.

Is there a workaround for this?

---

<div class="post-metadata">

**Author:** ![YF129701](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/yf129701/32/60498_2.png) [@YF129701](https://forum.inductiveautomation.com/u/YF129701)\
**Post date:** [September 22, 2023, 7:57pm UTC](https://forum.inductiveautomation.com/t/repeater-template-number-format/79522/2 "2023-09-22T19:57:55Z")

</div>

Is this just happening in your designer? I'm assuming in a session, that parameter would be populated, so presumably, it wouldn't error out. If you just want to test it in the designer to make sure the format is correct, just manually type a number into the parameter to check it...

I may be missing something because that sounds too easy. Can you attach a screenshot?

---

<div class="post-metadata">

**Author:** ![hw79](https://avatars.discourse-cdn.com/v4/letter/h/838e76/32.png) [@hw79](https://forum.inductiveautomation.com/u/hw79)\
**Post date:** [September 22, 2023, 8:11pm UTC](https://forum.inductiveautomation.com/t/repeater-template-number-format/79522/3 "2023-09-22T20:11:55Z")

</div>

I can't set the transform because the view.params property is a string and not a number, so the Format Pattern is greyed out.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/d/7d75478ea20c812e5f7094d7e448970e70c4d320.png)

---

<div class="post-metadata">

**Author:** ![YF129701](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/yf129701/32/60498_2.png) [@YF129701](https://forum.inductiveautomation.com/u/YF129701)\
**Post date:** [September 22, 2023, 8:13pm UTC](https://forum.inductiveautomation.com/t/repeater-template-number-format/79522/4 "2023-09-22T20:13:42Z")

</div>

I meant just go to your `Weight` view parameter and type in a number, like `1234.56789` to see if the formatting is working correctly. In a session, that param is probably being supplied into the view so it should work there

Like so:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/5/45b43f015cbdbd3810dfd07c2f230256656ee8c2.png)

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/7/87ab6bd9e6c301b1468fb9b2461faa1e78efdac8.png)

and finally,

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/5/b54540a4a4e1d17590789d4394a0599b265785a6.png)

Also, I just found out that you need to select `Pattern` from the first dropdown to get the Format Pattern text field to be editable - when it's set to `Number`, it'll be greyed out, regardless if you parameter is a number and if you set it to `Pattern`, it should be editable, regardless if your parameter is a number.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [September 22, 2023, 9:39pm UTC](https://forum.inductiveautomation.com/t/repeater-template-number-format/79522/5 "2023-09-22T21:39:54Z")

</div>

You can change from a **property** binding to an **expression** binding and format numbers like this:  
`numberFormat({view.params.Weight}, "0.00")`

You mention that the number is coming in as a string (which points to a problem elsewhere) so in that case you could modify the expression to,  
`numberFormat(toFloat({view.params.Weight}), "0.00")`

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [September 22, 2023, 10:07pm UTC](https://forum.inductiveautomation.com/t/repeater-template-number-format/79522/6 "2023-09-22T22:07:35Z")

</div>

There's three ways the param value could be a string even though you're expecting a number:

1. The param is received at the page level as part of a URL. URL param values are ALWAYS strings; you'd have to convert it yourself somewhere along the passing chain after it's been received by the page.
2. The param value is currently an empty string (or maybe `null`). Sorry, but if you default to an empty string, you're declaring the param might be a string and this is reasonable behavior.
3. Something within your own logic is setting the type of the param to be a string.

---

<div class="post-metadata">

**Author:** ![hw79](https://avatars.discourse-cdn.com/v4/letter/h/838e76/32.png) [@hw79](https://forum.inductiveautomation.com/u/hw79)\
**Post date:** [September 26, 2023, 1:22pm UTC](https://forum.inductiveautomation.com/t/repeater-template-number-format/79522/7 "2023-09-26T13:22:06Z")

</div>

Sorry for the delayed response, I was travelling.

I think the problem is with option 2. I'll try to change the default values to 0.00 instead of null and see what happens. However, I have some columns that have default values that are decimal numbers and still getting an error when trying to transform.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/0/90eaa63bae5f80766069a73aaea0b79870701c17.png)  
in this case the default value in the table is 48.5 and I still get an error. The datatype in my table is decimal(5,2).

@Transistor : I feel like this is because params show 'value' and aren't populated with real data until the query fires. I mean 'value' as a placeholder. See below.

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

---

<div class="post-metadata">

**Author:** ![hw79](https://avatars.discourse-cdn.com/v4/letter/h/838e76/32.png) [@hw79](https://forum.inductiveautomation.com/u/hw79)\
**Post date:** [September 26, 2023, 9:17pm UTC](https://forum.inductiveautomation.com/t/repeater-template-number-format/79522/8 "2023-09-26T21:17:46Z")

</div>

Just wanted to give an update. I added an expression in the binding and the template is still throwing an error, however, it's working in the project.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/5/3514752be171ea80cfa84f127d35e1422021fc88.png)

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

I'll consider it solved until there's a fix to how it shows up in the preview and template. 😃

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [September 27, 2023, 4:02pm UTC](https://forum.inductiveautomation.com/t/repeater-template-number-format/79522/9 "2023-09-27T16:02:33Z")

</div>

There's nothing to solve; the value you're trying to force a numeric format onto is a string value. To resolve your issue, use a numeric default value instead of a string `value`.

---

<div class="post-metadata">

**Author:** ![hw79](https://avatars.discourse-cdn.com/v4/letter/h/838e76/32.png) [@hw79](https://forum.inductiveautomation.com/u/hw79)\
**Post date:** [September 29, 2023, 6:17pm UTC](https://forum.inductiveautomation.com/t/repeater-template-number-format/79522/10 "2023-09-29T18:17:58Z")

</div>

I understand what you're saying, but what I don't understand is how to change the param to a number. When I add it to the view, it defaults to 'value'.

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

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [September 29, 2023, 6:23pm UTC](https://forum.inductiveautomation.com/t/repeater-template-number-format/79522/11 "2023-09-29T18:23:56Z")

</div>

Click on `value` and type `0`.  
It's the same way you'd set most properties.

---

<div class="post-metadata">

**Author:** ![hw79](https://avatars.discourse-cdn.com/v4/letter/h/838e76/32.png) [@hw79](https://forum.inductiveautomation.com/u/hw79)\
**Post date:** [September 29, 2023, 9:29pm UTC](https://forum.inductiveautomation.com/t/repeater-template-number-format/79522/12 "2023-09-29T21:29:48Z")

</div>

TIL

It's the simple things sometimes. Thanks for being patient with me.

---

<div class="post-metadata">

**Author:** ![YF129701](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/yf129701/32/60498_2.png) [@YF129701](https://forum.inductiveautomation.com/u/YF129701)\
**Post date:** [October 2, 2023, 9:30pm UTC](https://forum.inductiveautomation.com/t/repeater-template-number-format/79522/13 "2023-10-02T21:30:33Z")

</div>

> [@YF129701](#):
>
> I meant just go to your `Weight` view parameter and type in a number, like `1234.56789` to see if the formatting is working correctly

😉 what I said

---

<div class="post-metadata">

**Author:** ![hw79](https://avatars.discourse-cdn.com/v4/letter/h/838e76/32.png) [@hw79](https://forum.inductiveautomation.com/u/hw79)\
**Post date:** [October 2, 2023, 9:38pm UTC](https://forum.inductiveautomation.com/t/repeater-template-number-format/79522/14 "2023-10-02T21:38:19Z")

</div>

Yes, looking back at it, you're right. I didn't read it like that. I thought you meant type it in there to troubleshoot, not to set the param datatype. My bad.
