• Hi!

    I have 20 fields ACF,but conditionally. So if field 1 has content, field 2 is shown. So it is possible not al fields are filled.

    The calculation is sum(field_1+field_2+ etc.) for 20 fields. But when someone not uses all fields, the sum = 0. Even when some fields do have value.

    Is there a way to tell the calculation to only calculate fields when in order/filled. When conditionally not used, it will not be in the calculation (or as 0).

    Hope you understand what I try to explain. Thanks and best regards,

    Remco

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

Viewing 1 replies (of 1 total)
  • Plugin Contributor nick6352683

    (@nick6352683)

    I did not test this, so I could be wrong, but:

    – My understanding is that if a field is not shown due to a condition set in ACF, that field will simply not show up, thus your calculation will include a field or fields in this case that “technically” does/do not exist. The proof of that according to you, is that if all 20 fields are included because they all met the set conditions, all is well.

    I cannot think of a quick for that, as this is the way ACF handles conditions.

    – My suggestion is to use a Repeater field if possible, although not knowing exactly what you are building, it may or it may not be suitable for your needs.

    – Another suggestion would be to forget the conditions, and set default values (like 0) to all the 20 fields, and set them as mandatory fields too, for a foolproof solution. Reading again your question, I think this is what you possibly need.

    I might help you more if you provide a more detailed description what you are trying to build.

    Nick.

Viewing 1 replies (of 1 total)
  • The topic ‘Conditional Fields’ is closed to new replies.