Forum Academy Marketplace Showcase Pricing Features

Complex calculations

I am trying to calculate a learning plan, based on following user inputs:

  • Deadline
  • Repetitions

Then I would calculate dates for repetitions in the order, that the time till next repetition the Double of the previous is, for example 2, 4, 8, 16 day delays.
As output I would like to return a learning Schedule.
Here’s my Matlab code for this operation(there are bit more inputs):

deadline = 28;%days till deadline
x =0;%first review delay
r = 4;%number of reviews
c = 2; %review multiplyier

sum_buffer = 0;

for i = 1:r
    sum_buffer = sum_buffer + c^(i-1);

x = deadline/sum_buffer;

reviews  = 1:r;

for z = 1:r
    reviews(z) = round(x*c^(z-1));
    fprintf('reviev %d: %d\n', z, reviews(z));

Thank you very much for your response!

Just do it in the browser using Toolbox plug-ins (Run Javascript action and JS to Bubble element to return the value(s) back to Bubble). This is fairly straightforward once you’ve done it or seen how its done.

(Unfortunately, I haven’t seen the “canonical” tutorial post on using these elements in this way… I’m sure somebody’s got a slick video about this or something.)

Thank you!

Aha, Keith, this sounds like something you could handle : )

I know, this sounds noob, but can you help me with data communication between Javascript code and my bubble databank. For example, how do I store return values?

I made a video for y’all. Here it is:


See video I just posted in this thread. Perhaps helpful. Thanks for making this plug-in!

1 Like

Thank you very much!!!

1 Like

Keith, that’s a nice video you made, very enjoyable!
I like the teaser at the end hinting at another video.

Thank you : )

1 Like

Not sure where you’re with this but this plugin should make this very easy :smiley:

I have a question:

Is there a way to return myArray from javascript so that in the next action we to set a field of a thing = to the result of step 1?

hey Keith, I’m using the javascript in an Iframe and it’s saying the bubble function is undefined. What am I missing?

sorry, NO. Elements cannot return values to a workflow. You just access the value of the JS to Bubble element.

You CAN build a server side plugin though. (Probably not what you’re looking to do but FYI.)

That’s not how that works. The script is composed in the Run JavaScript element. See video.

The HTML I’m using is a map, and I’m trying to trigger a workflow from a click on an item in the map. What would I need to use to trigger the “run javascript” step from the HTML element?

Thanks for that video @keith !

Can anybody help me out

I am trying to run a calculation in a repeating group using two different dynamic data sets.

In the repeating group is a list of phones. The first dynamic data set is that each phone has a numerical score (out of 100) for how good 6 different features (e.g. a score of 48 out of 100 for battery life).

The second dynamic data set is the user’s preferences for the importance of the different features (e.g. a score of 85 out of 100 for the importance of a good battery). These would have already been set when they sign up.

When the user views the repeating group, I want a weighted calculation (using the user’s preferences and products features scores) for each product to show which product best suits their requirements.

I think it would be best that this calculation is calculated in the browser.

Would it be possible to run this using the toolbox plugin, or is their another way to do this?

Thanks in advance!

Use Repeating Group Tool (BDK)


Thanks a lot, I have downloaded the tool but do not see how it’s possible with the options it’s giving me. Please could you expand on how to use the tool in this way or point me in the direction of any documentation that could explain it?



For anyone who wants a little more commentary and description about how you use Run JavaScript with JavaScript to Bubble, here’s a follow-on that covers the same ground:

(Find in context in this other thread: Luhn Check for Credit Cards / Other - Javascript implementation)

1 Like