Converting min/mile

P

Is there a formula in Ninox that can convert a time of say "32:14" for 2 miles into Min:Sec per mile? In other words, I don't want 15.50 min/mile, rather I which to generate a text of "15:30" Thank you.

Ninox Profile

(number('Time field') / 60000) / 'Miles'

Birger

P

Thank you.

P

This doesn't work or more likely I don't understand how basic formulas function in Ninox.  Seems a bit complicated for something that other apps can do quite simply, that is format a text field to read minutes and seconds. Is there a way for the Time interval to be formatted in such a way to output as I desire: 15:30 or as Numbers does it 15m 30s?  I have a formula field that takes my overall time and converts it to seconds, so the conversion back to minutes and seconds could be done via total seconds of the walk or activity.  

By the way, I did buy the desktop app to help stimulate my old brain, but I don't want to fry it.  I have used database apps since 1992, so I know enough to get into trouble, but I find as others have found that documentation for this app is wanting.  It would be nice to maybe have a wiki dictionary of all the formulas and examples instead of having to rely on some very nice people to post code that can only be found if one knows the key search words.

Thanks.

Pete Schuder (Apprentice, Second rate) :-)

Ninox Profile

I'm sure there's another way, but this works...

 

if Miles != (null or 0) then
let myInterval := number(TimeInterval) / 60000 / Miles;
let myMin := round(myInterval);
let mySec := substr(text(myInterval - myMin), 2);
myMin + "m " + mySec + "s"
else
"0m 0s"
end

 

I used a TimeInterval field instead of a Time field and a Number field for miles. I think the Ninox Team should include links to frequently accessed parts of the manual on the forum page so that users who are unfamiliar with the site can navigate to those sections first if they are inclined. Here is a link to the language reference page...

 

https://ninoxdb.de/en/manual/calculations/reference-of-functions-and-language

 

P

Thank you for your input, it is very much appreciated.  Can I assume I put that formula (code) into a TimeInterval field, as you seem to indicate?  The coding is a bit new to me, so it will take some time to learn, but I am patient and can spend hours trying to figure things trial and error.  But it is like trying to type with one finger instead of 10 fingers and having the keys blank...ha, ha.  I will test out your code and see if I can get a better understanding of how Ninox code does things.  

Again, thank you for your help in advance, much appreciated.  I am off for my daily walk so I have more data to use.....

Ninox Profile

No, you put the code in a Formula field. I put the time in a TimeInterval field. It wasn't clear to me from the previous posts which type of field was used to store the time value and I wanted to be clear about which type of field I used to store it.

 

Most of my understanding Ninox and other languages is by taking the time to read and practice. Coding is my avocation not my occupation. ;)

Ninox Profile

I see there are issues with my formula and that is partly due to the inconsistent treatment of the TimeInterval field. If I use the "3867.37m" Number format for the TimeInterval field, seconds are (base 10) and not the expected (base 60). I'll look at it more when I can.

Ninox Profile

Which field type are you using for the raw time data?

P

Thanks for responding.  I agree that it takes time and practice (and patience) to learn a new computer language, but I am finding documentation to be quite limited compared to documentation for other database products I have used in the past.  Not really complaining, just feeling I should not need to rely on other users for simple coding.  So, as I said, I really appreciate your input.  

To answer your question.  I tried two methods for input of time.  One was as text putting in time as "32:15" in a text field.  The other was to use number fields and put 32 in one field (min) and 15 in the second field (sec).  In my previous experiences of converting overall time, I would use parsing code to separate the minutes and seconds and then do the math before bringing it back together again.  I did get close a few times as I was able to get the minutes, but the seconds would come up as .33 or some other number. I couldn't figure out how to get the seconds converted.

I probably shouldn't be doing any coding yet, as I should look at the videos and read up more on the basics.  All I was trying to do was convert my old database app to Ninox to see how it would work and see if I can learn some of the formulas.   

I looked at a video on Numbers where converting to min and sec is done in a few uncomplicated steps.  I was hoping that Ninox was fairly simple to use in creating fairly simple databases.  I have already done a few non-relational database samples to get my feet wet, but I come from an app that uses formulas and procedures to automat math and steps and uses a proprietary language, which maybe Ninox does as well?

As I indicated I wanted to keep my mind sharp, if possible, and try a simple laptop app for tracking my walking, among other things (tracking stocks, writing running workouts and saving the workouts as html to post on the web, as well as keeping track of a church's bookkeeping of offerings credits and donations and expenses as debits.  

I am hoping the learning curve isn't too steep, as I don't want to be discouraged.  Biggest problem is trying to remember what I just learned 10 minutes ago....ha, ha.

Thanks for your help.

 

1 2
Reply