• Resolved loppisinorge

    (@loppisinorge)


    Hi, im trying to make a simple calculator and stumbling a little bit.

    How do i do the following:
    – I want the calculator to show the overall average grade. But the calculator i made right now is not showing the desired result.

    For example, but i put in 3, 3, 3, 3, than i get a average grade on: 9.
    where in fact, it should be 3. How do i go about to fix this?

    You find the calculator i made on this website:
    https://www.norskeskoler.no/om-oss/

    It is located at the bottom.

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

    (@codepeople)

    Hello @loppisinorge

    You can use the AVERAGE operation in the Mathematical operations module (https://cff.dwbooster.com/documentation#mathematical-module)

    Please, enter the following equation in the “Set equation” attribute in the calculated field:

    AVERAGE(3,3,3,3)

    Best regards.

    Thread Starter loppisinorge

    (@loppisinorge)

    Thanks for replying, i added the average as you said. But it’s still not showing the average.

    heres what i put in:

    AVERAGE(fieldname12+fieldname26+fieldname13+fieldname38+fieldname25+fieldname37+fieldname24+fieldname36+fieldname23+fieldname35+fieldname22+fieldname34+fieldname21+fieldname33+fieldname20+fieldname32+fieldname19+fieldname31+fieldname18+fieldname30+fieldname17+fieldname41+fieldname16+fieldname29)

    Plugin Author codepeople

    (@codepeople)

    Hello @loppisinorge

    If you sum the fields you are not calculating their average.

    The correct would be:

    AVERAGE(fieldname12,fieldname26,fieldname13,fieldname38,fieldname25,fieldname37,fieldname24,fieldname36,fieldname23,fieldname35,fieldname22,fieldname34,fieldname21,fieldname33,fieldname20,fieldname32,fieldname19,fieldname31,fieldname18,fieldname30,fieldname17,fieldname41,fieldname16,fieldname29)

    Thread Starter loppisinorge

    (@loppisinorge)

    The values are not 3,3,3,3 constant. They change pending on the users grade. How do i set it up, so that the calculator automatically picks up every fieldname i wrote earlier and their values, and calculates the average?

    Plugin Author codepeople

    (@codepeople)

    Hello @loppisinorge

    Please, read my previous entry.

    Best regards.

    Thread Starter loppisinorge

    (@loppisinorge)

    I’m terribly sorry for being ignorant and useless.
    Thank you for taking time to help!

    Basically, I’m trying to recreate this calculator:
    https://karkalk.no/

    Which shows the average grade. It adds up all the numbers/credits and divides it by the amount chosen.

    For example: 3 + 4 + 5 + 6 = 18 / 4 = which gives 4.5.
    That’s all i am trying to do haha. I just need to know how to do so.
    Once again, thanks for taking the time to help.

    Thread Starter loppisinorge

    (@loppisinorge)

    When using:

    AVERAGE(fieldname12,fieldname26,fieldname13,fieldname38,fieldname25,fieldname37,fieldname24,fieldname36,fieldname23,fieldname35,fieldname22,fieldname34,fieldname21,fieldname33,fieldname20,fieldname32,fieldname19,fieldname31,fieldname18,fieldname30,fieldname17,fieldname41,fieldname16,fieldname29)

    It gives the wrong answer.

    Plugin Author codepeople

    (@codepeople)

    Hello @loppisinorge

    It is important you follow my instructions. I checked your form again, and you have not replaced the plus (+) symbols by commas (,) in the equation of the fieldname43 as I recommended in a previous entry.

    Best regards.

    Thread Starter loppisinorge

    (@loppisinorge)

    Can you check again?
    I copy-pasted:

    AVERAGE(fieldname12,fieldname26,fieldname13,fieldname38,fieldname25,fieldname37,fieldname24,fieldname36,fieldname23,fieldname35,fieldname22,fieldname34,fieldname21,fieldname33,fieldname20,fieldname32,fieldname19,fieldname31,fieldname18,fieldname30,fieldname17,fieldname41,fieldname16,fieldname29)

    I put in 3 + 4 + 5 +6. This should be 18 in total and divided by 4, it should than be 4.5.

    Instead it is 0.75 as the picture shows:
    https://pasteboard.co/QfnkysRH9Zjv.png

    • This reply was modified 2 years, 11 months ago by loppisinorge.
    • This reply was modified 2 years, 11 months ago by loppisinorge.
    Plugin Author codepeople

    (@codepeople)

    Hello @loppisinorge

    If you have AVERAGE(a,b,c,d,e) and you enter only the values of a = 3, b = 4, and c =5, the plugin will evaluate the operation as follows:

    AVERAGE(3,4,5,0,0) = (3+4+5+0+0)/5 = 12/5 = 2.4 and not 4

    Best regards.

    Thread Starter loppisinorge

    (@loppisinorge)

    How can i fix it so that last calculated field, shows the right number?
    I follow copied your solution and it still does not show. I showed you the link i wanted to copy.

    Thread Starter loppisinorge

    (@loppisinorge)

    Im trying all kind of solutions and im not getting the correct number.

    Plugin Author codepeople

    (@codepeople)

    Hello @loppisinorge

    If you want to ignore fields with zero value, you can edit the equation as follows:

    AVERAGE([fieldname12,fieldname26,fieldname13,fieldname38,fieldname25,fieldname37,fieldname24,fieldname36,fieldname23,fieldname35,fieldname22,fieldname34,fieldname21,fieldname33,fieldname20,fieldname32,fieldname19,fieldname31,fieldname18,fieldname30,fieldname17,fieldname41,fieldname16,fieldname29].filter(function(n){ return n != 0; }));

    Best regards.

    Thread Starter loppisinorge

    (@loppisinorge)

    That worked!!!

    Thank you so much! πŸ˜€

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

The topic ‘Simple calculator’ is closed to new replies.