Bug/Issue saving to Database


I’m making an app that collects some measurements and creates dashboards based on them. For each item (anthropometric measurement) I need to collect 3 times and evaluate the median of these 3 measurements and which 2 are the closest to each other. Then I need to save on the database the median and the 2 closest measurements.

To do this I used the following:

Collect measurements from inputs → Run JS (calculate) → JS to Bubble (return values) → save results from JS to Bubble Elements to database.

The bug/issue is that the database is only saving some of the results from the calculations.

I’ve being checking all the steps to see if there’s something wrong, but I can’t figure it out.

"i_MassaCorporal_M"s are the inputs to collect de measurements for the same item.
“js2b_MassaCorporal” are the JS to Bubble to return the calculated values.
“Text js2b_MassaCorporal”s I used to check if the JS to Bubble elements were returning the correct values.

As you can see the inputs were NUMBERS 5, 4 and 9.

The JS identified the inputs.

It selected correctly the median.

And selected correctly the 2 closest numbers.
03_valores mais proximos

Here you can see that they are really numbers.
10_Confirmação que são numeros

And it returned correctly the median (text elements with dynamic data from the JS to Bubble elements).

And it returned correctly the 2 closest numbers (text elements with dynamic data from the JS to Bubble elements).

To this point everything is working perfect. The bug/issue happens when I try to save the numbers to the database.

Here you can see that I used the exact same workflow and commands for every JS to Bubble element.

However, the workflow is saving numbers from some JS to Bubble but not from all of them.

Here are somethings I thought it could be (aren’t):
-When building the design, I copied and pasted the JS to Bubble Elements instead of inserting new one’s. I tried inserting new one’s but still didn’t work.
-It can’t be the type of data that the JS to Bubble Elements is returning (since I checked with “typeof”).
-I checked the name of every element countless times.

I really need help with this.