• Resolved Mr. Peri

    (@mr-peri)


    Hi,

    I have a very complicated calculator with a lot of dependencies upon dependencies with different prices, etc. I have created a DIV field to keep all the prices together, a DIV field to keep all the Widths together and same for the Thicknesses. The calculator consists out of dropdowns for the various types of wood, then their width is chosen and then their thickness is chosen and once you have all of those it opens the price for it per m3. A client can then enter a length and the calculator must then calculate the price for the total m3. Ideally I want to final calculation to work on what ever the result was of the dependencies chosen. The problem is it seems I cant use DIV fields in a calculation.
    Example:
    Calculation field’s calculation is:
    PREC(((fieldname2/1000)*(fieldname34/1000)*(fieldname37/1000)*fieldname16),2)

    where fieldname34 and fieldname37 and fieldname16 are DIV fields. Fieldname16 for example is 12 currency fields consisting of 12 different prices that is pulled into a result of a dependency chosen in fielname34 or fieldname37.

    I thus want the calculator to be able to use the dependencies that shows up in the DIV field once a previous dependency is chosen in the calculation.

    Does that make sense….?

    The page I need help with: [log in to see the link]

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

    (@codepeople)

    Hello @mr-peri

    No, you cannot use the DIV fields in mathematical operations.

    Honestly, if all dependent fields are pairs for width and height, does not much sense includes many of them of them with only one pair would be enough (I’m sorry, I cannot check your form because you have enabled the maintenance mode on your website.)

    Anyway, you simply should know the values of dependent fields is zero, when these fields are disabled.

    For example, assuming the width fields are: fieldname1, fieldname2, and fieldname3, only one of them wuold be enabled at once because they were defined as dependent.

    and the fields: fieldname4, fieldname5, and fieldname6 are the corresponding length fields, and only one would be enabled as once.

    The equation to calculate the area would be:

    
    (fieldname1+fieldname2+fieldname3)*(fieldname4+fieldname5+fieldname6)
    

    Because, as the value of disabled fields is zero, they don’t affect the sum operation.

    Best regards.

    Thread Starter Mr. Peri

    (@mr-peri)

    it’s not just length and width, it’s a type of wood, each type has a set of widths and thicknesses and each selection of widths and thicknesses has a price. I took the under construction function of if you want to go and check the page

    Plugin Author codepeople

    (@codepeople)

    Hello @mr-peri

    The answer would be the same: as only the active fields affect the sum operations, you can include all of them in the equation, in a similar way I did in the previous entry.

    Best regards.

    Thread Starter Mr. Peri

    (@mr-peri)

    Even if the fields aren’t 0? Because some of the fields are set values and can’t be changed by the user so the fields aren’t 0 if not in use…

    Plugin Author codepeople

    (@codepeople)

    Hello @mr-peri

    Exactly!!!! even if the fields values is not zero, if they were defined as dependent and they are disabled, their values into the equations would be zero.

    Best regards.

    Thread Starter Mr. Peri

    (@mr-peri)

    Ok, please help me then with my formula. This is the standard one:
    PREC(((fieldname2/1000)*(fieldname34/1000)*(fieldname37/1000)*fieldname16),2)

    But fieldname34, depending on the dependency chosen, could be fieldname35 or fieldname51, and fieldname37 could be 38 or 39 or 40 or 41 and fieldname16 could be 17 or 18

    I tried:
    PREC(((fieldname2/1000)*((fieldname34/1000)OR(fieldname35/1000)OR(fieldname51/1000))*((fieldname37/1000)OR(fieldname38/1000)OR(fieldname39/1000)OR(fieldname40/1000)OR(fieldname41/1000))*(fieldname16)OR(fieldname17)OR(fieldname18)),2)

    and it didn’t work

    Plugin Author codepeople

    (@codepeople)

    Hello @mr-peri

    I’m sorry, I guess you’ve not understood the concept. If fieldname34, fieldname35 and fieldname51 are all dependent and exclusive (and the same for the other groups of field) the equation would be:

    
    PREC((fieldname2 / 1000) * ((fieldname34+fieldname35+fieldname51) / 1000) * ((fieldname37+fieldname38+fieldname39+fieldname40+fieldname41)/ 1000) * (fieldname16+fieldname17+fieldname18), 2)
    

    Best regards.

    Thread Starter Mr. Peri

    (@mr-peri)

    Ah! fantastic!! thank you!! it’s working perfectly!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Div field in calculations’ is closed to new replies.