• Hi,

    I have now spent about 3 hours trying to get 1+2 to be 3 and failed. There are so many ways you can write a formula and when the documentation has gaps and you cannot see the result other than in the editor, it takes time…

    My setup:
    PHP Version: 7.3.16
    PHP Max Input Vars: 3000
    PHP Max Post Size: 128M
    WP Version: 5.4.1
    WP Multisite: No
    Memory limit: 768M
    Advanced Custom Fields version 5.8.9 (not the Pro version)
    Calculated fields for ACF version 1.2.4

    Here is what I have:
    In a Field Group called GroupA (there is no way you can create Fields outside of a Group) I have created 2 Fields called FieldA and FieldB.

    FieldA is written as follows:
    – Field Label: FieldA
    – Field Name: fielda (autogenerated to all small letters)
    – Field Type: Number (recommended by the documentation)
    – Formula: left blank (this is the new field that this plugin adds to the ACF field editor.)
    – Read only: Yes (from one of the 3 screenshots, but I’ve tried no as well)
    – Default Value: 1 (this is the 1 in 1+2)
    – Evrything else left blank (I’ve tried with Minimum & Maximum Value set to 1 as well without it making any difference)

    I’ve also tried with the 1 in Formula Field, it does not really say anywhere where you are supposed to put the value you want. If it says something you could interpret that it should actually for into that Formula Field, but I don’t know.

    I then duplicated the FiealdA and renamed the Field Label to FieldB, Field Name to fieldb and the Default Value to 2, (this is the 2 in 1+2).

    Then I created the Summary field called Sum. Up til now this has been basic ACF since I really have not used the Formula Field yet (I have tried with it used as well as mentioned above).

    Sum is written as follows:
    – Field Label: Sum
    – Field Name: sum (autogenerated to all small letters)
    – Field Type: Number (recommended by the documentation BUT in one of the 3 Screenshot it is set to Text, I have tried both.)
    – Formula: fielda + fieldb (I have also tried FieldA + FieldB, fielda+fieldb, FieldA+FieldB, (fielda)+(fieldb) and all other combinations with/without spaces around the + since in some of the text and screenshots they are without, and you could interpret that parantheses are useful)
    – Read only: Yes (again from one of the 3 screenshots, but I’ve tried no as well)
    – Evrything else left blank

    Then, in my WP Editor and Elementor, I insert 3 ACF fields, the 3 mentioned above. I use the Dynamic Field options, where all 3 show up.

    FieldA correctly shows as 1
    FieldB correctly shows as 2

    Sum shows nothing, no error, no zero, no null, just nothing. Not in the Editor, nor in the Page Preview. The FieldA/B numbers 1 and 2 show up immediately in the Editor. I do not know if the Sum calculation is supposed to show up there as well, it does not say anywhere. It is a bit of a pain that you cannot verify your formula in the ACF interface when you enter it, to say the least.

    Please advise what/where I am going wrong and/or what I have not understood. I really do want this to work, as I am sure you understand by the time and effort I have put into this.

    Best regards,

    //Matthias

Viewing 6 replies - 1 through 6 (of 6 total)
  • I managed to get it to work with regular fields i.e. not fields in a Repeater or Group and I did this by having Number fields so…

    FieldA (Number field)
    FieldB (Number field)
    Result (Number field) with formula FieldA + FieldB

    Not sure if that helps but I’ve been battling with this as well!

    Thread Starter Matt

    (@mybcn)

    Thank you! Appreciate you taking your time on this. Well, that is great, it means that it does work, it most likely has to be my installation… I have also done that, 2 numeric fields, in the same group, with the formula FieldA + FieldB. Now I did it again and it still does not work. I don’t get it. ??

    Thread Starter Matt

    (@mybcn)

    OK, if this works for you then it could be Elementor. I’m using the Dynamic Content feature of Elementor Pro to access the Sum field. Is there another way to display this data that does not involve Elelentor? Can you use shortcode %something% or %%something%%?

    Plugin Author wundermatics

    (@wundermatics)

    Hi Matthias,

    I can assure you this plugin works as expected for most people ??

    First thing I should mention is that fields in a formula expression should be spelled exactly as the name with regards to case. In your case it would be: fielda + fieldb

    As long as you are working in the wp-admin dashboard, field calculations should show up in real time as you type. As the actual calculation is maade via Ajax, the response time from your server could potentially add some lag. This real time editing should work inside metaboxes in both classical editor and Gutenberg. But you mention Elementor, may I ask what Elementor-plugins you are using for this?

    Thread Starter Matt

    (@mybcn)

    Hi!

    So happy to hear this! I’m going nuts from this not working! ??

    I’m using Elementor Pro to pull the ACF into the Editor. I’m working in the WP Admin Dashboard, as far as I know, is there any other way? Where in the Interface should I see the calculated value?

    //Matthias

    Thread Starter Matt

    (@mybcn)

    Hi,

    Getting back on this since I simply can not get it to work at all. Here is my ACF Setup:

    Field Group “UNESCO Global”
    Field Label “WHS Inscribed TOTAL”
    Field Name “whs_inscribed_total”
    Field Type “Number”
    Default Value of “333”

    Field Group “UNESCO Visited”
    Field Label “WHS Inscribed Total VISITED”
    Field Name “whs_inscribed_total_visit”
    Field Type “Number”
    Default Value of “222”

    In the Field Group “UNESCO Visited” I have created another Field to calculate the difference between Field Name “whs_inscribed_total” and Field Label “WHS Inscribed Total VISITED” to get the number remaining (left to visit).

    Field Group “UNESCO Visited”
    Field Label “WHS Inscribed Total Visited LEFT (Calculated)”
    Field Name “whs_inscribed_total_visit_left”
    Field Type “Number”

    FORMULA “unesco.global.whs_inscribed_total – whs_inscribed_total_visit”

    This should give me the result “111”, but I get nothing. I am using both a text block with the [acf field=”whs_inscribed_total_visit_left”] to visualize and fetching it via the Dynamic Tag / ACF Field in Elementor.

    I hope this is enough info for you to help me figure this one out.

    //Matthias

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Does this plugin actually work?’ is closed to new replies.