HI, so i need to round numbers up to the nearest full integer. So for instance if my number is 1.2 it has to round up to 2. But i noticed that with the “round” formula it rounds down to the nearest integer which would be 1. But in my use case this would lead to wrong calculations.
Is there a way to round any number with decimals up to the ceiling??
Using Math.ceil works just fine in the formula view - and doesn’t particularly add complexity or unreadability to the result. All weweb formulas are wrappers for javascript functions, and they do their jobs best when they are focused on weweb-specific concerns and let the easy parts of JS do their job.
Sure, just know that a formula is a javascript expression. If you want to do complexe stuff, you can go the the ‘js’ version which allow you to have intermediate variable etc (you just need to return the final result)
But something like myVar.map(item => ({label: item.label}) will totally work.
Small disclaimer, be aware that we are working in Vue. If you are doing complex logic, this will be rerun each time one of its dependencies change.
Also avoid anything mutative, like .sort for example (our implementation is safe)