Forum Academy Marketplace Showcase Pricing Features

Calculations of API values using Javascript

I need advice on the best way of making some calculations on values fetched using the NASA Power API. Some of the resulting values will be displayed in the app, and some stored in the backend.

This is an example url:

I believe this could be done using the Toolbox plugin, and some simple lines of Javascript, but I have not done this before. I think I can figure out the loops/formulas, but I need advice on how to set this up in Bubble, API, and Toolbox plugin.

For example: I want to calculate the average of all January values etc. Then I want to run a loop(?) to find out which month has the highest/lowest average values.

Appreciate any advice, and let me know if I need to clarify. Thanks.

Hey Niklasl, below some info about doing calculations in Bubble and connecting to API’s:

How to Build a Calculator App in (2/3) - YouTube

How to Connect APIs to Bubble io Tutorial Part 1

Also see Bubble’s lessons for info about using API’s.

Hi @gerbertdelangen,

Thanks for replying, but that first video is only about making calculations from user input, not API data. And the second video is just about reading in API data to groups. I have figured out how to read single values from the API url, but not yet how to read and do math operations on multiple API data values.

I’m not sure if I am explaining my problem in a good way, but if you look at the url I provided it might help?

An attempt to clarify what I want to do:

There is API data values of 20 years and every month. In other words there is 240 different values that I want to do some math operations on, before I store some results in the backend. I am new to bubble, but it does not seem right to first add these 240 values to the database, and afterwards analyze the numbers?