• Resolved Graicifyd

    (@graicifyd)


    Hello,

    Please how can I sum up the individual numbers in a date field? For example, if the following date is inputed:

    11-12-2020

    I would like to sum up

    ‘1+1’ + ‘1+2’ + ‘2+0+2+0’

    in a calculated field.

    Thank you for your support in advance.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @graicifyd

    If the date field is the fieldname1, you can implement the equation similar to:

    
    eval([...fieldname1|r.replace(/[^\d]/g,'')].join('+'))
    

    There are many other alternatives.

    I’m sorry, but the support service does not cover the implementation of the users’ projects (forms or formulas). If you need additional support to implement your project’s equations, do not hesitate in contact me through my private website: Custom Coding Service

    Best regards.

    Thread Starter Graicifyd

    (@graicifyd)

    Thank you so much.

    Thread Starter Graicifyd

    (@graicifyd)

    What if I want to sum up the numbers in a calculated field, for example:

    28 |= 2 + 8 =10

    Plugin Author codepeople

    (@codepeople)

    Hello @graicifyd

    My recommendation would be to convert the number in a string, and apply exactly the same logic of the previous entry:

    
    eval([...(new String(28)).replace(/[^\d]/g,'')].join('+'))
    

    Best regards.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘SUM UP THE DIGITS IN A DATE FIELD’ is closed to new replies.