# 🧮 New Math functions

Try this:

500*ROUND(X/500)

5 Likes

Hi Glide Team, I agree with @wjcv06 and would also like LEFT, RIGHT and SUBTRING functions ?
In my case, need to find a workaround to show differents time periods for charts with https://quickchart.io/ : data presented as in a stringt list with coma separations !

Screenshot 2020-10-18 at 19.00.22|245x500

1 Like

how about a ternary operator like
predfact=medfact * (sex='F" ? 1.018 : 1.000)

although i would rather have it as
predact=medfact * (if sex=‘F’ then 1.018 else 1.000)
or
predfact=medfact*(if sex=‘F’ then lookupF(age) else lookupM(age))

ie. the values returned by the conditional statement are inline values or variables, or values of functions or other math expressions

2 Likes

it works well, thanks!

2 Likes

Waiting for countifs and average if for automate counting survey result…

1 Like

Jeff - I thought this syntax could work for rounding (always) up the current time to nearest 0:30 min using ceiling function. First, tried X as a now math column. Then tried incorporating now within the formula. I’m stumped. Any insight?

is it possible to round up to exact places after the dot?
something like from 1.423 to 1.43

@administrasi_kitsda Have you looked into using relation, rollup, and math columns to get counts and averages?

@Rasha I spent some time last night trying to come up with a math formula to do that. I feel like I’m close, but I don’t know yet if it’s possible.

@A.I.Office I don’t think you can specify number of decimals, but if you take your value, multiply by 100, Perform a Ceiling on that result, then divide by 100. Should look something like `CEILING(X*100)/100`

6 Likes

i’ll try that, thanks

1 Like

Appreciate the time you spent on this @Jeff_Hager. I can live without for the time being.

1 Like

@Rasha I think I got it. I feel pretty good about this one. This formula will calculate the time to the next half hour. It does float between 0 and 1 seconds after the minute, but appears to stick on the exact minute of the next half hour and switching to not show seconds will give you a good view. I did watch the time switch from 5:59 to 6:00 and after that, the value changed from 6:00 to 6:30, so I feel pretty good about it.

The kicker here is that this will require a seed date. This will need to be a column with a date/time. The date and hour can be anything, but the minutes and seconds need to be on the hour, so equal to 0. For example, this is what I have as a seed date/time.

This is the complete math formula:

``````X+
(
CEILING(((X-Seed)-ROUND(X-Seed))/.0208333)
-
FLOOR(((X-Seed)-ROUND(X-Seed))/.0208333*1000)/1000
)
/48
``````

Hope it works for you.

Edit: This may be better and just a hair more accurate. Basically the same either way.

``````X+
(
CEILING(((X-Seed)-ROUND(X-Seed))*48)
-
FLOOR(((X-Seed)-ROUND(X-Seed))*48*1000)/1000
)
/48
``````
10 Likes

@Jeff_Hager your help on this one is invaluable - a million thanks! I think the seed column won’t present an obstacle to flow - we’ll see. Will work through this in the coming days and share where I end up.

2 Likes

TRUNC(Number, 2)

Is this possible to just TRUNC to a certain decimal point? like does it take two arguments?

Looks like only 1 argument. If you want 2 decimal places, just multiply the number by 100, Trunc that result, then divide by 100. I would think Floor would probably do the same thing.

TRUNC(X*100)/100

But what about something like 23.45637?

And I goal is the just and only cut down to 23.45 without it auto rounding.

Yep, that’s why you multiply by 100 to move the decimal to the right 2 places, then the Trunc will remove anything to the right of the decimal. Finally the divide by 100 will move the decimal back to it’s original location. Trunc (and Floor) wouldn’t round anything with the formula I gave.

Good Morning

@Jeff_Hager, You can call me Buddha (nickname) My name is Franklin. Sorry to bother you, but
I’m having a problem with a service scheduling app, I’ve been trying for a month and I haven’t found a solution, I’m new to the developer area and I’m not able to do the logic. In this app there are 2 attendants with 10 services and the duration of the hours is 6 different. (ex: service 01 duration 1/4 hour.
service 5 duration 2h
service 10 duration 4 h.
I can put in the hours, but if I select time 10 that lasts 4 hours, I need to make the other services’ schedules disappear … and I don’t know how to do it. these date and time calculations.
Would you help me?
I’m from Brazil and I’m using the google translator, forgive if there are any errors …

I would use these mostly to fiddle with names. ie. to extract just the given name or family name from a full name. Isn’t always 100% reliable, but avoids having to use multiple columns to store names.

Edit: Actually, having those functions available would solve the problem that I described here (ie. instead of doing the string manipulation in the GSheet and waiting for it to sync, I could have it done instantly in Glide)

2 Likes

Has this been rolled out?

Has there been any update to add math functions like LEFT?

Use case: we’re creating an app to help my wife and I collect and test names for our new baby. I built a feature to concatenate a First + Middle + Last name so we can see how the full name looks. My wife is now asking if we can have some display that shows the initials, ie FIRST MIDDLE LAST would show “FML” (woah…).

My approach to this would be using Left(FIRST,1) + Left(Middle,1), etc… but it doesn’t look like this is possible right now.

1 Like