Modify API data in plugin or modifying returned data in workflow

This is probably an easy one, but keep in mind I don’t know programming for any for m of internet (JS, html, etc etc), thats why I am using bubble in the first place

Anyway, so my plugin makes an API call. The data I get back has no decimal places. So I want to divide the number I get by 100,000,000

I expect I have to do some sort of action or something? I assume this action work initiate as soon as data is retrieved from the API?

So here is the specific:

Yes, I could simply divide that in my bubble app. But the API should return the correct number which is this number divided by 10^8

Can someone point me correctly on this?

So, I cant even seem to divide by 10^8 in a workflow. The division shown here is not being performed.
47%20PM

But when I do that division in a text field element it seems to work just fine. Is there an explanation for this?

Sidenote, I cant use parentheses in the workflow stuff either?

Simply doesnt see the 100000000

Its frustrating when you don’t realise what Bubble is doing.

The expression is evaluated left-to-right, so Bubble sees:

Total Supply - Redemptionbalance
/ 10000000

No parentheses! :frowning:

you can rearrange it to:

RedemptionBalance * -1
/ 100000000
+ TotalSupply

For better expressions there are lots of plugins available.

Yup, I finally got it.

Can yo Uname a favorite plugin for good expressions? I’ve been using math.js, but I dont like putting invisible squares everywhere

Stilll, is there a decent guide for non net programmers on how to do more that API calls in a plug in?

Does this odd left to right thing also happen in the Math.js block too? How do I get real math done?

Does this help?
http://mathjs.org/docs/expressions/syntax.html#implicit-multiplication

I saw that…not really. Maybe I just dont know how to use math.js with bubble. I thought I could put in parentheses in the expression field. But when I try that , bubble then no longer gives me drop down lists of items to add to the expression. Its just as limited as not having math.js

Example. here is a math.js expression. I expect that it doesnt do the stupid left to right math anymore…but it does

Have you considered using JS toolbox vs the math.js plugin?
If you were to get your code to work in codepen, you could easily add it to your page.

I dont know what codepen is. I have tried math.js (shown above), toolbox and instant calculator. The issue isnt me failing to find something that claims to solve this, the issue is that documentation on using any API in bubble fails tremendously when it comes to documentation on exactly HOW to use them. Again, they all claim to allow me to use parentheses, which would solve these problems. But when I go to use them, I can only put in the first open parens, and then bubble always fails to give me dynamic data choices afterwards .

What am I doing wrong when I’m trying to make math.js evaluate a simple expression?

you could set a state to hold what you would put into a parenthesis. then just do the math on the states.

this will also work if you need to use toolbox


claims to solve this

Be patient and give yourself some credit. For someone who doesn’t know coding, you’ve come a long way to get to this problem.

Just because you can use parentheses, doesn’t mean you’re doing it right in Bubble. No offense intended. Sometimes the subtitles of js can be “lost in translation”.
Which why getting things to work in codepen.io makes life easier in the long run.

…but the above should work

just put what is at 00:49 into a state

Here’s that annoying part… I have to put all the products into states…can do. But the products are right there…in those text fields on right. I have already calculated them and they are sitting there. Is there no way to pull the number out of a textfield?

I guess I will make states for each of the products and then the text fields will use those states and just prints them, then the product sum, will just sum the states.

Is it normal to have dozens of states? Thats the path I am on. Is there a page where I can just see all the states and what they belong to?

thanks for that. I forget. I’m a pretty good programmer for 8-bitters, and in C and the kind of programming we used to do from the 70’s to the 90’s. This “new” shit is totally beyond me.

There are ways to pull a number out of a txt field using parseInt().

I often have dozens of states as local variables. I keep them on a single element to make life easier.

I was in the same boat. The good news is that the concepts are the same as they were in the 70’s.

At the end of the day, Bubble sends a normal HTML5/JS/CSS file to the browser. View the Bubble editor as a code editor.

lol. code editors let me use parentheses

parenthesis are overrated