# Native bubble calculation

Hi all, hopefully someone good with bubble calculation functions will be able to help.

I want to divide a number by 3 but keep whole numbers.

So for example, if I input a number that is not divisible by 3, lets say 31, I want the output to be a list of 11, 10, 10 and another example would be an input number of 1259, the output list would be 421, 419, 419.

Because I couldn’t work it out in bubble I used javascript and it worked fine to generate the numbers but I have been having serious issues with trying to save the result to the database. No matter what I have tried, the trigger to create a new record always fires before I get the result of the javascript. I have tried saving the result to a custom state and then running the workflow from the custom state but the ‘create new thing’ trigger pretty much always runs quicker (a couple of times it has worked but 99% of the time it doesn’t). I have tried the ‘if x record is not empty’ condition but it just doesn’t fire at all if I add conditions. i have tried custom events, backend workflows, everything, and always the same result.

Ideally a native bubble calculation for this would be great.

1 Like

Hi Nico, yes, I solved the first step of getting the javascript to work but since then I have tried to create new records with the result of the javascript and it is proving difficult so I would like to try and achieve it with native bubble calculations.

I’m just gonna toss this out here and pretend I am confident this is the answer:

1st Number: `([number]/3):ceiling`
2nd Number: `([number]/3):floor`
3rd Number: `([number]/3):floor`

1 Like

Thanks for the input Tyler, I was literally trying this solution as your message comes in, I will let you know the results!

1 Like

I tried it with 1259 and it didn’t work, I think you’ll have to do this instead

1st Number: `1259 - ((1259/3):floor * 2 )`
2nd Number: `(1259/3):floor`
3rd Number: `(1259/3):floor`

1 Like

Hero, this works a treat, thanks for your help

1 Like