Title: Numeric Calculation
Last modified: February 3, 2022

---

# Numeric Calculation

 *  [in-business](https://wordpress.org/support/users/in-business/)
 * (@in-business)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/numeric-calculation-2/)
 * Hello again,
 * Sorry to keep asking lots of questions, but once I have the main setup done, 
   I will be good to go…so thank you for your patience.
 * Is there a way with the current version, or possibly with your upgraded version
   to count entries in a “Multiselect Checkbox” – so for example, if the multiselect
   was as follows:
 * Car Design:
 *  – Leather seats: Checked
    – Alloy wheels: Checked – Metallic paint: Unchecked–
   Satnav: Unchecked – Diesel: Checked
 * So in this case all the “Checked” items would equate to 1 and all the “Unchecked”
   items would equate to 0, which means the total would equal 3 in the above example.
 * Thank you

Viewing 15 replies - 46 through 60 (of 94 total)

[←](https://wordpress.org/support/topic/numeric-calculation-2/page/3/?output_format=md)
[1](https://wordpress.org/support/topic/numeric-calculation-2/?output_format=md)
[2](https://wordpress.org/support/topic/numeric-calculation-2/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/numeric-calculation-2/page/3/?output_format=md)
4 [5](https://wordpress.org/support/topic/numeric-calculation-2/page/5/?output_format=md)
[6](https://wordpress.org/support/topic/numeric-calculation-2/page/6/?output_format=md)
[7](https://wordpress.org/support/topic/numeric-calculation-2/page/7/?output_format=md)
[→](https://wordpress.org/support/topic/numeric-calculation-2/page/5/?output_format=md)

 *  Plugin Author [xnau webdesign](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/numeric-calculation-2/page/4/#post-15376729)
 * I’m also seeing that the newly-calculated value does not immediately appear in
   the record after submitting. I’m looking into the reason for this, thanks for
   your patience.
 *  [crowwoods1](https://wordpress.org/support/users/crowwoods1/)
 * (@crowwoods1)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/numeric-calculation-2/page/4/#post-15381063)
 * Thank you, Roland, for looking into this! As soon as the points get updated immediately,
   I’m ready to roll the project out.
 *  [crowwoods1](https://wordpress.org/support/users/crowwoods1/)
 * (@crowwoods1)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/numeric-calculation-2/page/4/#post-15384345)
 * I’m sure you’re also seeing this, but in my debugging log, it looks like the 
   program goes through 4 passes of the Numeric Calculation fields:
 * It goes through one pass of the Numeric Calculation fields right before one is
   logged in.
 * Then it goes through 2 passes of the Numeric Calculation fields before the record
   is updated with all the changes. Then all the fields are updated with the changes,
   except the Numeric Calculations fields are updated with changes from the previous
   time.
 * After the Record is updated, it does a Refresh Cache and then goes through one
   more pass of the Numeric Calculation fields.
 * I don’t know which pass is for the normal Form Element calculation, and which
   is for the one going through pdb-custom-calc-field.php. Could it be that the 
   filter hook in the program just needs to change to one that’s before the Record
   is updated?
 * Thanks, Ivy
 *  [crowwoods1](https://wordpress.org/support/users/crowwoods1/)
 * (@crowwoods1)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/numeric-calculation-2/page/4/#post-15400810)
 * Hi Roland,
 * Any luck figuring out why the calculated value is not updating the record immediately?
 * Thanks!
 *  Plugin Author [xnau webdesign](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/numeric-calculation-2/page/4/#post-15400896)
 * I fixed this in version 2.0.4, make sure you’re using the latest version of Participants
   Database.
 *  [crowwoods1](https://wordpress.org/support/users/crowwoods1/)
 * (@crowwoods1)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/numeric-calculation-2/page/4/#post-15400919)
 * I am. I’m using version 2.0.5 but it’s still not saving the current updates. 
   I’ve cleared my cache too.
 *  Plugin Author [xnau webdesign](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/numeric-calculation-2/page/4/#post-15401024)
 * Wait…you say it’s not saving the updated values? That’s different than what I
   thought we were talking about, I thought the problem was the updates were getting
   saved, you just didn’t see the result in the record when the page reloaded after
   saving. That was an issue I also saw in my tests and fixed.
 * Since I don’t know how you have it configured, I’m kindof guessing what the problem
   is. If you have values in the calculation template that are also calculated fields,
   it will often take two passes to update the value, that’s just the way it has
   to work because it doesn’t try to figure out which fields need to be calculated
   first.
 *  [crowwoods1](https://wordpress.org/support/users/crowwoods1/)
 * (@crowwoods1)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/numeric-calculation-2/page/4/#post-15401371)
 * No, I have a blank calculation template. That’s why I’m getting this message 
   in my debugging log, which you said I can ignore.
    calculation template format
   not recognized for template: =[?unformatted]
 * And because using the template takes 2 passes to update the value, I am using
   
   pdb-custom-calc-field.php and that’s what I’m expecting to update the data immediately.
 *  Plugin Author [xnau webdesign](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/numeric-calculation-2/page/4/#post-15401507)
 * OK, now I remember, but I’m still unclear on this point: with your code, does
   that new value save on the first pass, but the new value isn’t visible until 
   the page is reloaded?
 * OR…does it take two passes for the value to be updated in the record?
 * Are you using calculated fields in the calculation you’re performing in your 
   custom plugin? If that is the case, you may have to make sure that your calculation
   is using the fresh results from those calculated fields.
 * I’m sorry this is so complicated, but I’m trying to figure out what problems 
   are the plugin and which problems are in your custom code. So far, that is unclear
   to me.
 *  [crowwoods1](https://wordpress.org/support/users/crowwoods1/)
 * (@crowwoods1)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/numeric-calculation-2/page/4/#post-15401625)
 * With the custom code, after I update the Earth Day Challenge actions in the record
   and press Save, the actions are saved, but not the points right away. But if 
   I press Save one more time (with or without changes), then those last points 
   would show up. Leaving the record and logging back in has no effect on the points
   being updated any sooner. That means the participant would have to press Save
   twice to get the correct points.
 * The good thing is the 3 kinds of calculated points and the total points get updated
   at the same time. The 3 calculated fields based on updated actions seem to be
   calculating fine. So if there’s anything wrong with the custom code, it may be
   where the hook is being placed.
 *  [crowwoods1](https://wordpress.org/support/users/crowwoods1/)
 * (@crowwoods1)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/numeric-calculation-2/page/4/#post-15401633)
 * The other possibility is that since these have to numeric calculation fields,
   the template interferes with the custom code.
 *  Plugin Author [xnau webdesign](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/numeric-calculation-2/page/4/#post-15402232)
 * What you describing is what would happen if your custom code is attempting to
   calculate a result based on other calculated fields, but the other fields’ values
   haven’t been calculated yet.
 * I don’t know if I have a way to do this. I suppose you could achieve some success
   by changing the order of the fields (by dragging them on the Manage Database 
   Fields page) so that the field that uses your custom code is last.
 * Also, you should use a “dummy” calculation template in the field you’re processing
   with your custom code, doesn’t matter what it is as long as it is a valid template.
   I am adding some code in the next update that will remind people to put in the
   template if they haven’t, so a blank template won’t be acceptable after that.
   I’ve had too many people ask me why the calculated field wasn’t working and it
   was because they hadn’t typed in the calculation template correctly, this helps
   them get it right the first time.
 *  [crowwoods1](https://wordpress.org/support/users/crowwoods1/)
 * (@crowwoods1)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/numeric-calculation-2/page/4/#post-15402280)
 * The only calculated field that’s based on other calculated fields is the total
   points field. And that field is after the 3 other points calculations. In the
   Manage Database Fields page, the 4 Points calculation fields are in its own field
   group called Points. What’s after the Points field group are Field Groups and
   Help. In my mind they are already the last thing to process.
 * ok, I put a dummy calculation template in them. No more template unformatted 
   message.
 *  [crowwoods1](https://wordpress.org/support/users/crowwoods1/)
 * (@crowwoods1)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/numeric-calculation-2/page/4/#post-15402393)
 * By the way, according to my debugging log, the 4 points fields are processed 
   4 times:
    1st time – before one is logged in LOGGED IN 2nd and 3rd time – after
   login and before record is updated RECORD UPDATED 4th time – after record is 
   updated
 * Which is the time processed by the custom calc program? I wonder if it’s that
   4th pass, as the updated record does not show the points updated.
 *  [crowwoods1](https://wordpress.org/support/users/crowwoods1/)
 * (@crowwoods1)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/numeric-calculation-2/page/4/#post-15404962)
 * New idea, Roland.
 * To get around my problem of the calculated fields not saving, perhaps because
   of the total points being based on other calculated points, is there a way it
   can save twice when someone updates their record? That would solve my problem.
 * Thanks!!!

Viewing 15 replies - 46 through 60 (of 94 total)

[←](https://wordpress.org/support/topic/numeric-calculation-2/page/3/?output_format=md)
[1](https://wordpress.org/support/topic/numeric-calculation-2/?output_format=md)
[2](https://wordpress.org/support/topic/numeric-calculation-2/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/numeric-calculation-2/page/3/?output_format=md)
4 [5](https://wordpress.org/support/topic/numeric-calculation-2/page/5/?output_format=md)
[6](https://wordpress.org/support/topic/numeric-calculation-2/page/6/?output_format=md)
[7](https://wordpress.org/support/topic/numeric-calculation-2/page/7/?output_format=md)
[→](https://wordpress.org/support/topic/numeric-calculation-2/page/5/?output_format=md)

The topic ‘Numeric Calculation’ is closed to new replies.

 * ![](https://ps.w.org/participants-database/assets/icon-256x256.jpg?rev=1389807)
 * [Participants Database](https://wordpress.org/plugins/participants-database/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/participants-database/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/participants-database/)
 * [Active Topics](https://wordpress.org/support/plugin/participants-database/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/participants-database/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/participants-database/reviews/)

 * 94 replies
 * 3 participants
 * Last reply from: [xnau webdesign](https://wordpress.org/support/users/xnau/)
 * Last activity: [4 years, 2 months ago](https://wordpress.org/support/topic/numeric-calculation-2/page/7/#post-15429988)
 * Status: not resolved