• Resolved dcaccounting

    (@dcaccounting)


    Is it possible to have this? I’ll try to give an example, it seems to work like this currently:

    Item A: 10 – (ticked or selected from dropdown)
    Item B: 20 – (ticked or selected from dropdown)
    Item C: 40

    Total = 30

    I’m trying to achieve this:

    Item A – (ticked or selected from dropdown)
    Item B – (ticked or selected from dropdown)
    Item C

    Total = 30

    Kind regards

    Dean

    https://www.ads-software.com/extend/plugins/calculated-fields-form/

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

    (@codepeople)

    Hi Dean,

    You should put the price into the text of the item so it can be identified and included in the calculation.

    An alternative to avoid placing the prices into the items is to use the ternary operator but that way the formula will become more complex and it depends of the complexity of your form, so the recommended way is to put the price as part of the text.

    Thank you for using the plugin!

    Thread Starter dcaccounting

    (@dcaccounting)

    Perhaps you might think about including a ‘pre-defined’ value per line item in a future update?

    Regards

    Dean

    Plugin Author codepeople

    (@codepeople)

    Yes, that’s in the TO-DO list for a future update.

    Thank you for your comments!

    Thread Starter dcaccounting

    (@dcaccounting)

    Actually, could you give me an example of how the ternary operator would work on the above example?

    Regards

    Dean

    Plugin Author codepeople

    (@codepeople)

    The sample form “Ideal Weight Calculator” included in the plugin makes use of the ternary operator.

    If you want a more specific sample, please post a support request at https://wordpress.dwbooster.com/contact-us and include a link to the page that contains your form to give you a sample rule according to your form configuration.

    Thank you!

    Thread Starter dcaccounting

    (@dcaccounting)

    Thanks, I might just have to do that!

    One last quick question; when you use the dropdown box method, the total doesn’t update until all boxes have been selected?

    Regards

    Dean

    Plugin Author codepeople

    (@codepeople)

    At least one value should be selected/edited in each box/field used in the calculation in order to be able to complete the calculation. You can set a default value for each field so you don’t have to fill all of them before getting a result.

    Thank you!

    Thread Starter dcaccounting

    (@dcaccounting)

    How do you set a default value of zero until something is selected. I have something that looks like this:

    Please select (so this is displayed in the box field)
    No – Item A: 10
    Yes – Item B: 50
    Yes – Item C: 100

    Regards

    Dean

    Plugin Author codepeople

    (@codepeople)

    If you are using the latest version (published today) you can use this formula:

    (fieldname5>=’A’?0:fieldname5)

    Note: The field was referenced as “fieldname5” for this sample. Replace that with the real name of the field in your form.

    That way if a text without numbers is selected then a 0 will be used as value, otherwise the number in the field will be used.

    That’s a workaround for the current version. The feature for adding hidden values to the fields is still in the TO-DO list.

    Thank you!

    Thread Starter dcaccounting

    (@dcaccounting)

    I’m using this:

    (fieldname11>=’Please seclect’?0:fieldname11)

    It doesn’t work. Are you saying I need to do this:

    (fieldname11>=’Please seclect’?0:No – Item A: 10, Yes – Item B: 50, Yes – Item C: 100)

    So that when ‘please select’ is shown it will give a nil value and when someone selects something else it’ll show that value instead.

    Regards

    Dean

    Plugin Author codepeople

    (@codepeople)

    You should use exactly this:

    (fieldname11>=’A’?0:fieldname11)

    … comparing it to the uppercase ‘A’ will cover any text into the field. If the problem persists please open a ticket at https://wordpress.dwboster.com/contact-us to check the problem in detail.

    Thank you!

    Thread Starter dcaccounting

    (@dcaccounting)

    Thank you! ??

    Regards

    Dean

    I’m just getting into this plugin.
    I figured out you can nest the javascript ternary operators.

    Let’s say I am using Flat Rate shipping boxes and all the items for this form are identically sized.

    1 item = $6.95 shipping.
    2 through 8 items (fits in the next box size) = $17.95 shipping.
    9 through 16 items (fits in 2 of those boxes) = $35.90 shipping.

    fieldname8 is a “shipping” or “store pickup” dropdown.
    fieldname9 is a ‘total items being shipped’.

    This works:

    (fieldname8==’Store Pickup’?0:1)*(fieldname9==1?6.95:(fieldname9>8?35.90:(fieldname9>1?17.95:0)))

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Individual value for choices – hidden value’ is closed to new replies.