• Resolved collegeoftrades

    (@collegeoftrades)


    Hi there,

    I’m trying to determine which language can be used for the equations. I understand it takes Javascript. Does this also take pHp or anything else?

    I’m trying to create a calculator that would spit out different answers for different categories, based on the number enter.

    Example:
    Select trade: (70 different trades..)
    Enter Journeypersons (a number), which would then calculate the # of
    Apprentices.

    Any assistance would help. Thanks in advance

    https://wordpress.org/plugins/calculated-fields-form/

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

    (@codepeople)

    Hi,

    The equations only use javascript code.

    I’m sorry, but I’ll need more details to help with the equation.

    Best regards.

    Thread Starter collegeoftrades

    (@collegeoftrades)

    Thanks for getting back to my question.

    Javascript it is. That is the important part of my question.

    This would be a sample of the type of equation we would need. X being the number entered in, and Y being the output:

    Explanation:
    if x= 1-2, then y=1;
    (if ‘x’ is within the range 1-2, then ‘y’ equals 1)

    but if x>2, then y=(x-1)/2+1
    (if ‘x’ is greater than 2, then ‘y’ equals ‘x’ minus 1, divided by 2, plus 1 – rounded down to nearest integer)

    Hope this makes sense. If not I apologize, I’m sure I’m probably not being clear.

    Plugin Author codepeople

    (@codepeople)

    Hi,

    Yes, that’s possible and very simple:

    For the demo, I will call X, fieldname1, to use the same fields names that our plugin. So, the equation would be:

    (function(){
    if(fieldname1 >= 1 && fieldname1<=2) return 1;
    if(fieldname>2) return floor( (fieldname1-1)/2+1 );
    })()

    Best regards.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘What kind of coding language does this use?’ is closed to new replies.