# Modify API data in plugin or modifying returned data in workflow

**URL:** <https://forum.bubble.io/t/modify-api-data-in-plugin-or-modifying-returned-data-in-workflow/43063>\
**Category:** Plugins\
**Created:** [November 22, 2018, 8:52pm UTC](https://forum.bubble.io/t/modify-api-data-in-plugin-or-modifying-returned-data-in-workflow/43063 "2018-11-22T20:52:45Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![hirscr](https://avatars.discourse-cdn.com/v4/letter/h/7feea3/32.png) [@hirscr](https://forum.bubble.io/u/hirscr)\
**Post date:** [November 22, 2018, 8:52pm UTC](https://forum.bubble.io/t/modify-api-data-in-plugin-or-modifying-returned-data-in-workflow/43063/1 "2018-11-22T20:52:45Z")

</div>

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:

 ![06%20PM](https://us1.discourse-cdn.com/bubble/original/3X/f/1/f1a66bb2805ea88c0dc39f0ea5ecd0cf09f687da.png)

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?

---

<div class="post-metadata">

**Author:** ![hirscr](https://avatars.discourse-cdn.com/v4/letter/h/7feea3/32.png) [@hirscr](https://forum.bubble.io/u/hirscr)\
**Post date:** [November 23, 2018, 9:30pm UTC](https://forum.bubble.io/t/modify-api-data-in-plugin-or-modifying-returned-data-in-workflow/43063/2 "2018-11-23T21:30:03Z")

</div>

So, I cant even seem to divide by 10^8 in a workflow. The division shown here is not being performed.  
 ![47%20PM](https://us1.discourse-cdn.com/bubble/original/3X/7/8/78d3540cc14a116676cc0724f24af9907f8880a7.png)

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?

---

<div class="post-metadata">

**Author:** ![hirscr](https://avatars.discourse-cdn.com/v4/letter/h/7feea3/32.png) [@hirscr](https://forum.bubble.io/u/hirscr)\
**Post date:** [November 23, 2018, 9:39pm UTC](https://forum.bubble.io/t/modify-api-data-in-plugin-or-modifying-returned-data-in-workflow/43063/3 "2018-11-23T21:39:35Z")

</div>

![38%20PM](https://us1.discourse-cdn.com/bubble/original/3X/0/3/03d454a5218256c8406bdcdbc20161e1c07836dd.png)

Simply doesnt see the 100000000

---

<div class="post-metadata">

**Author:** ![mishav](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mishav/32/6420_2.png) [@mishav](https://forum.bubble.io/u/mishav)\
**Post date:** [November 24, 2018, 8:03am UTC](https://forum.bubble.io/t/modify-api-data-in-plugin-or-modifying-returned-data-in-workflow/43063/4 "2018-11-24T08:03:14Z")

</div>

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! ☹

you can rearrange it to:

RedemptionBalance \* -1  
/ 100000000  
`+` TotalSupply

For better expressions there are lots of plugins available.

---

<div class="post-metadata">

**Author:** ![hirscr](https://avatars.discourse-cdn.com/v4/letter/h/7feea3/32.png) [@hirscr](https://forum.bubble.io/u/hirscr)\
**Post date:** [November 24, 2018, 1:24pm UTC](https://forum.bubble.io/t/modify-api-data-in-plugin-or-modifying-returned-data-in-workflow/43063/5 "2018-11-24T13:24:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hirscr](https://avatars.discourse-cdn.com/v4/letter/h/7feea3/32.png) [@hirscr](https://forum.bubble.io/u/hirscr)\
**Post date:** [November 25, 2018, 1:51am UTC](https://forum.bubble.io/t/modify-api-data-in-plugin-or-modifying-returned-data-in-workflow/43063/6 "2018-11-25T01:51:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hirscr](https://avatars.discourse-cdn.com/v4/letter/h/7feea3/32.png) [@hirscr](https://forum.bubble.io/u/hirscr)\
**Post date:** [November 28, 2018, 5:43pm UTC](https://forum.bubble.io/t/modify-api-data-in-plugin-or-modifying-returned-data-in-workflow/43063/7 "2018-11-28T17:43:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![scottb50](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/scottb50/32/9334_2.png) [@scottb50](https://forum.bubble.io/u/scottb50)\
**Post date:** [November 28, 2018, 8:47pm UTC](https://forum.bubble.io/t/modify-api-data-in-plugin-or-modifying-returned-data-in-workflow/43063/8 "2018-11-28T20:47:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hirscr](https://avatars.discourse-cdn.com/v4/letter/h/7feea3/32.png) [@hirscr](https://forum.bubble.io/u/hirscr)\
**Post date:** [November 28, 2018, 9:14pm UTC](https://forum.bubble.io/t/modify-api-data-in-plugin-or-modifying-returned-data-in-workflow/43063/9 "2018-11-28T21:14:08Z")

</div>

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

 ![50%20PM](https://us1.discourse-cdn.com/bubble/original/3X/b/5/b564c7916a10dec866f206db27ee14c118b64573.png)

---

<div class="post-metadata">

**Author:** ![scottb50](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/scottb50/32/9334_2.png) [@scottb50](https://forum.bubble.io/u/scottb50)\
**Post date:** [November 28, 2018, 9:19pm UTC](https://forum.bubble.io/t/modify-api-data-in-plugin-or-modifying-returned-data-in-workflow/43063/10 "2018-11-28T21:19:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![hirscr](https://avatars.discourse-cdn.com/v4/letter/h/7feea3/32.png) [@hirscr](https://forum.bubble.io/u/hirscr)\
**Post date:** [November 28, 2018, 9:21pm UTC](https://forum.bubble.io/t/modify-api-data-in-plugin-or-modifying-returned-data-in-workflow/43063/11 "2018-11-28T21:21:24Z")

</div>

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 .

---

<div class="post-metadata">

**Author:** ![hirscr](https://avatars.discourse-cdn.com/v4/letter/h/7feea3/32.png) [@hirscr](https://forum.bubble.io/u/hirscr)\
**Post date:** [November 28, 2018, 9:30pm UTC](https://forum.bubble.io/t/modify-api-data-in-plugin-or-modifying-returned-data-in-workflow/43063/12 "2018-11-28T21:30:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![scottb50](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/scottb50/32/9334_2.png) [@scottb50](https://forum.bubble.io/u/scottb50)\
**Post date:** [November 28, 2018, 9:42pm UTC](https://forum.bubble.io/t/modify-api-data-in-plugin-or-modifying-returned-data-in-workflow/43063/13 "2018-11-28T21:42:00Z")

</div>

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

* * *

> **[CodePen](https://codepen.io/)**
>
> An online code editor, learning environment, and community for front-end web development using HTML, CSS and JavaScript code snippets, projects, and web applications.

> 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](http://codepen.io) makes life easier in the long run.

…but the above should work

---

<div class="post-metadata">

**Author:** ![scottb50](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/scottb50/32/9334_2.png) [@scottb50](https://forum.bubble.io/u/scottb50)\
**Post date:** [November 28, 2018, 9:44pm UTC](https://forum.bubble.io/t/modify-api-data-in-plugin-or-modifying-returned-data-in-workflow/43063/14 "2018-11-28T21:44:24Z")

</div>

just put what is at 00:49 into a state

---

<div class="post-metadata">

**Author:** ![hirscr](https://avatars.discourse-cdn.com/v4/letter/h/7feea3/32.png) [@hirscr](https://forum.bubble.io/u/hirscr)\
**Post date:** [November 28, 2018, 9:49pm UTC](https://forum.bubble.io/t/modify-api-data-in-plugin-or-modifying-returned-data-in-workflow/43063/15 "2018-11-28T21:49:16Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![hirscr](https://avatars.discourse-cdn.com/v4/letter/h/7feea3/32.png) [@hirscr](https://forum.bubble.io/u/hirscr)\
**Post date:** [November 28, 2018, 9:59pm UTC](https://forum.bubble.io/t/modify-api-data-in-plugin-or-modifying-returned-data-in-workflow/43063/16 "2018-11-28T21:59:03Z")

</div>

> [@scottb50](#):
>
> For someone who doesn’t know coding, you’ve come a long way to get to this problem

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.

---

<div class="post-metadata">

**Author:** ![scottb50](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/scottb50/32/9334_2.png) [@scottb50](https://forum.bubble.io/u/scottb50)\
**Post date:** [November 28, 2018, 9:59pm UTC](https://forum.bubble.io/t/modify-api-data-in-plugin-or-modifying-returned-data-in-workflow/43063/17 "2018-11-28T21:59:23Z")

</div>

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

> **[Converting strings to numbers with vanilla JavaScript](https://gomakethings.com/converting-strings-to-numbers-with-vanilla-javascript/)**
>
> In JavaScript, you can represent a number is an actual number (ex. 42), or as a string (ex. '42').
> If you were to use a strict comparison to compare the two, it would fail because they’re two different types of objects.
> var num1 = 42; var num2 =...

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

---

<div class="post-metadata">

**Author:** ![scottb50](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/scottb50/32/9334_2.png) [@scottb50](https://forum.bubble.io/u/scottb50)\
**Post date:** [November 28, 2018, 10:07pm UTC](https://forum.bubble.io/t/modify-api-data-in-plugin-or-modifying-returned-data-in-workflow/43063/18 "2018-11-28T22:07:41Z")

</div>

> [@hirscr](#):
>
> This “new” shit is totally beyond me.

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.

---

<div class="post-metadata">

**Author:** ![hirscr](https://avatars.discourse-cdn.com/v4/letter/h/7feea3/32.png) [@hirscr](https://forum.bubble.io/u/hirscr)\
**Post date:** [November 28, 2018, 10:10pm UTC](https://forum.bubble.io/t/modify-api-data-in-plugin-or-modifying-returned-data-in-workflow/43063/19 "2018-11-28T22:10:22Z")

</div>

lol. code editors let me use parentheses

---

<div class="post-metadata">

**Author:** ![scottb50](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/scottb50/32/9334_2.png) [@scottb50](https://forum.bubble.io/u/scottb50)\
**Post date:** [November 28, 2018, 10:15pm UTC](https://forum.bubble.io/t/modify-api-data-in-plugin-or-modifying-returned-data-in-workflow/43063/20 "2018-11-28T22:15:16Z")

</div>

parenthesis are overrated

[Next page](https://forum.bubble.io/t/modify-api-data-in-plugin-or-modifying-returned-data-in-workflow/43063.md?page=2)
