I'm having trouble summing text values inside of a repeater. I can easily sum values outside of a repeater but am having trouble with it being inside one. Below is my current code. Both text 14 and 45 are inside the same container.
export function dropdownfilter_change(event, $item) { $item('#text46').text = String(Number($w('#text45').text) + Number($w('#text14').text)); }
when I run this code text46 turns into '2' regardless of that text50 or text45 is. In screenshot below text45 = 22.02 and text14=15,41. Most of the tutorials I find are about inputs being added together but this is a text that happens to be a number. Any help or guidance is apreciated!
![](https://static.wixstatic.com/media/f3849c_deb78f21262a4975abeefdc8ec841323~mv2.png/v1/fill/w_76,h_56,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/f3849c_deb78f21262a4975abeefdc8ec841323~mv2.png)
Hi! Show that #text45 and #text14 are both displaying numerical values. If they contain any non-numeric characters (e.g. $ or ,), the Number() function will not be able to parse them correctly and the result of the sum will be NaN (Not a Number). Use parseFloat() instead of Number() to parse the values of #text45 and #text14. parseFloat() is a more lenient function and can handle strings with non-numeric characters (e.g. $22.02 or 15,41). If #text45 and #text14 are both within a repeater, you may need to use the getCurrentItem() function to access their values.