# Better way to do sum data? Kind of able to do this but my way doesnt seems right

To the experts out there.
I am fresh from bubble tutorial, and am making my first app concept.
I kind of able to do what I want … that is, I get my apps working.
But I suppose I did it in a very stupid way …
Looking for input, wondering if there is a better way, or there isnt a better bubble native way and I should look for third party / plugins?

My Trial App:

I made this apps to simplify my trial-and-error stuff.
The goal of this apps is to calculate how many Yellow Bricks, Green Bricks, and Blue Bricks will be needed for the project.

WORKFLOW STEP 1
The first step of my workflow is very simple.

on Button Click, I have all the data values filled. In this case, I fill the length, width, and height of my two box.

WORKFLOW STEP 1.5
When a yellow brick is needed and when when green is needed, I use “Input” form and put the CONDITIONAL to determine initial value. From my limited understanding, this is the closest “if-then” of Bubble?

WORKFLOW STEP 2
The second step of my workflow is to get the color value from the “Input” to my data value.

WORKFLOW STEP 2.5
THEN it gets … very repetitive. And the place that I think I did in a not-so-good way.
I make several other input, each one is used to determine the amount of “Yellow bricks in box 1”, “Green bricks in box 1”, etc. each Input assigned the value by CONDITIONAL.

WORKFLOW STEP 3 AND FINAL RESULT
Afterwards my workflow collect these newly-made input values.
And do one final calculation to do finally get how many yellow bricks are there!

In summary, it WORKS.
but.

1. It is very prone to manual error. As I assign the CONDITIONAL in step 1.5 and 2.5 manually … there are bounds to be an error, if the data is big enough. While I suppose this step can’t be passed, but I am wondering if there are better ways.
2. Step 1.5 (and 2.5) is basically almost like a PERMUTATION. In my case I only made 3 sample so the amount of input I prepared is 3^2 = 9. Still manually feasible to be done.
But in my real apps, and probably other apps with same logic, it won’t be only 3 parameters …
While technically I can manually put CONDITIONAL for tens of my permutation, it is still very risky?
3. I did all of it in USER field, as it saved me time. Not sure if this is the best way, but even a single extra step is burdensome since what I am doing is manual work on permutation …

Anyone knows better way?
Or anyone knows a plugin that can do what I did in a much better way?

Thanks!

After letting this soak in my mind for the night.
It is now solved.
My solution is … using Javascript.

1 Like

I have a feeling you could do all this on page without any workflows.

Would be interested know.
I think at least there has to be one, for saving the input to data?

Still,

With how many “if … else if” I am making, manually clicking the conditional section for each input is way too taxing, and very hard to see whether there is a misspelling or wrong logic.

Whereas I can use just write and write it in single go with If … else if in one place. Plus the ability to copy paste.
Also, it’s much faster to type advanced calculation as javascript that is not just addition or multiplying.

Bubble do make things convenient though, being able to get dynamic text value in the script directly.

This topic was automatically closed after 70 days. New replies are no longer allowed.