• Resolved Sportuojantys

    (@needfeed)


    Hello, I want to create calculator, which sums your birthday date to single digit. Let’s try with: 1991-12-01

    For example:

    fieldname12 is 1991

    fieldname8 is 12

    fieldname11 is 1

    so the sum would be:

    fieldname12+fieldname8+fieldname11

    1991+12+1=2004

    But I need that calculator would sum all numbers to single digit:

    2+0+0+4 = 6

    I tried with digSum, but failed.

    Maybe you have some advices how to solve it?

    Thanks in advance 🙂

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

    (@codepeople)

    Hello @needfeed

    Thank you very much for using our plugin. You can do something similar to the following equation:

    SUM(SUM(fieldname12, fieldname8, fieldname11).toString().split(''));

    And that’s all.

    Best regards.

    Thread Starter Sportuojantys

    (@needfeed)

    I tried with January (value is 1) 1st (value is 1), of 1991 (value is 1991), and the number is double digit: 22

    Can we make it single digit? 2+2=4?
    https://ibb.co/80qdfMX

    And how does it look like with sum of YEARS number only (fieldname12) to a single digit?

    Thanks for your help 🙂

    Plugin Author codepeople

    (@codepeople)

    Hello @needfeed

    If you want to repeat the process until the result be lower than 10, you can use a loop statement. Like:

    (function(){
    var result = SUM((fieldname12).toString().split(''));
    
    while(10 <= result) result = SUM((result).toString().split(''));
    
    return result;
    })()

    Best regards.

    Thread Starter Sportuojantys

    (@needfeed)

    Yes, this formula with years sum is working fine.

    I tried this formula with all the date sum, but somethings wrong here?

    (function(){
    var result = SUM((fieldname12, fieldname8, fieldname11).toString().split(”));

    while(10 <= result) result = SUM((result).toString().split(”));

    return result;
    })()

    Plugin Author codepeople

    (@codepeople)

    Hello @needfeed

    In your case, you must use the SUM operation twice.

    The first time you must sum the fields, and then their digits.

    In my example, it is unnecessary because it sums only the digits of a single field.

    So, the equation would be:

    (function(){
    var result = SUM(SUM(fieldname12, fieldname8, fieldname11).toString().split(''));
    
    while(10 <= result) result = SUM((result).toString().split(''));
    
    return result;
    })()

    Best regards.

    Thread Starter Sportuojantys

    (@needfeed)

    Thank you, codepeople, calculator is working fine 🙂

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Sum to single number’ is closed to new replies.