Numbers Field

Viewing 2 reply threads
  • Author
    Posts
  • January 18, 2022 at 11:27 PM #46340

    Eddy
    Participant

    Hello Folks!

    I have a problem with a numbers field.

    The numbers field {German: “Zahl”} is set to the time format “time (years, months, days)”. I need this field to set a payment deadline for invoices.

    The field should have a default value {German: Standardwert}. But the only value that works is a “0”. This gives me in a new record the entry “0 years, 0 months, 0 days).

    So, what do I have to write into ‘default value’ in order to get for example a result of “0 years, 0 months, 14 days” or “0 years, 3 months, 0 days”?

    Thanks in advance.

    Eddy

    January 19, 2022 at 1:14 AM #46341

    Brendan
    Keymaster

    Hi Eddy,

    Set the value to the number of seconds in your desired time span.

    A Number field with any of the TIME number formats specified always stores the actual value in the database as the number of seconds and then it’s converted to the display format chosen.

    Thanks,

    Brendan

    January 19, 2022 at 1:15 AM #46342

    Sam Moffatt
    Participant

    If you edit the field setting it to that time format, change the date to the value you want and then change the format back to “no style” again, it’ll give you the number corresponding to the value in the field. You can then use this as the default and it’ll work with the formatted field.

    It looks like the field is stored as the number of seconds when in time mode which somewhat makes sense since that’s the smallest unit of time the formats support. One day is 86400 seconds (24 hours x 60 minutes x 60 seconds), so 14 days would be 14 days in seconds or 1209600.

    3 months is weird, I used the first method to find the value (set the field to 3 months then swap to no style) and it gave me 2630016. If I divide that out by 86400, I get 30.44 days which seems like perhaps the system is accounting for the variability of a month being 28, 29, 30 or 31 days. Keymaster will have to comment on that for more details but hopefully that makes sense.

Viewing 2 reply threads

You must be logged in to reply to this topic.