Hello, I am adding the new calendar view to an app (good addition!).
I am struggling to do what I consider should be an easy time manipulation. I have a field that contains the start day [Date] and the start time [Heure] and how long it took (in minutes) [Durรฉe (โ)]. I added a virtual column to create the end timeโฆ [End time]. Events happen in the middle of the day and never last more 6 hours so I can assume the end date is same as start date. So to use the calendar view, I just need to calculate the end time. So I want to make a virtual column [End time] that contains the result I want. Something like :
[Heure]+[Durรฉe (โ)]. Of course this throws an error as [Durรฉe (โ)] is not formatted as a duration like โ000:30:00โ for instance as per the onlide doc (https://help.appsheet.com/expressions/expression-types/date-and-time-expressions) . In fact, I do not find any syntax that worksโฆ I tried [Heure]+[Durรฉe (โ)]/60 hoping that it would magically take into account fractions of hours
precisely but it fails too (it does not throw any error but rounds it to the smallest integer as would do the Floor operator)โฆSo, any idea to calculate an End Time base on a Start Time and a number of minutes? Best, Manu
You need to convert the minute as a duration with a virtual column. It could be something likeโฆ CONCATENATE(FLOOR([DURATION]/60),":",MOD([DURATION],60),":00")
Hi, thanks for the answer! I came to the same conclusion indeed.
In fact I had to work around a few bugs or at least weird behaviorsโฆ
[Heure]+[Durรฉe (โ)]/60
kind of work but only adds 0, 1 or 2โฆ(integers) to the Time or
[Heure]+CEILING([Durรฉe (โ)]/60) does not helpโฆ
So, here is the outcome:
If I do directly :
[Heure]+CONCATENATE( CONCATENATE(โ00โ, FLOOR([Durรฉe (โ)]/60)) , if(MOD([Durรฉe (โ)],60)>9, CONCATENATE(":",MOD([Durรฉe (โ)],60)), CONCATENATE(":0",MOD([Durรฉe (โ)],60)) ) , โ:00โ ) I get an error of type mismatch. So I have to create an intermediary virtual column indeed [FormattedDuration] and set its type to DURATION as you mention:
CONCATENATE( CONCATENATE(โ00โ, FLOOR([Durรฉe (โ)]/60)) , if(MOD([Durรฉe (โ)],60)>9, CONCATENATE(":",MOD([Durรฉe (โ)],60)), CONCATENATE(":0",MOD([Durรฉe (โ)],60)) ) , โ:00โ ) Only then the [End Time] column can be built and give the expected result: [Heure]+[FormattedDuration]
My feedback after this: time functions documentation should be enriched, and there are probably some lacks in the possibilities offered.
Ex: [Heure]+Duration([Durรฉe (โ)],minutes) or so could exist to simply add minutes to a specific time without to go thru the mentioned complex ops.
Best, Manuel
Yes thatโs true. Btwโฆ you donโt need to add those extra zeros with the IF statement. The app formula will recognize them.
Thanks Aleksi!
User | Count |
---|---|
43 | |
26 | |
23 | |
14 | |
13 |