Forum Replies Created

Viewing 15 replies - 61 through 75 (of 89 total)
  • Roland,

    ok, I’m back to doing the calculations in a php file. I am putting it in a Code Snippets file. Can you tell me what the hook name should be for doing the calculations in the Participant Record? I assume my custom code comes in when the user press Save.

    Roland,

    I want to see if I can do my Plan B, which is to pass the participant data to a 3-party form that can do the point calculations. I’ve already set everything up in that form to gather the actions, do the calculations, and post it back to the database. But seeing how it can’t tell who’s logged-in in pdb, I don’t know if there’s a way to pass the id from one to the other, when they’re connected by a link.

    Thanks, Ivy!

    That was pdb-records-default.php in the plugins/participant database/template folder, copied over to the participant database template folder and renamed. That was the wrong file?!

    What is the name of the plugin you’re talking about? And where is it?

    I do this custom coding in pdb-record-custom.php. Right?

    I mean use JavaScript in the attributes.

    It sounds like I can’t use the Numeric Calculation field at all because it won’t be updated when the participant first updates their records. Only after their updates are recorded in the database before the Numeric Calculation field could work. That means the first Save is just to record their numeric fields, and the 2nd Save is to do the Numeric Calculation fields.

    My question is: can I write custom html in the attributes area of a numeric field to add up the points instead?

    You mean I can construct a calculation template in the numeric field?

    Hmmm, I just realized that my problem is bigger than that. When the participant updates their action fields, the 2 calculated fields won’t reflect the updates. They in essence have to hit that Submit button twice to get the 2 Calculated Fields. Then they have to hit it a 3rd time to get the sum of the two Calculated Fields.

    Is there a way to hit Save 3 times for them when they hit it once?

    Hi,

    Me again. One more issue I may have to work around. I am summing 2 Calculated Fields since the numeric fields and checkbox fields are adding up so nicely. I notice that when I submit the first time, that 3rd Calculated Field (total_points) doesn’t get calculated. I understand that it’s because the first 2 Calculated Fields doesn’t get added to the database until I press Submit. Is there a way to get around that?

    Ivy

    Hi,

    I just got the checkbox fields to work. It turns out I had to add a 0 for the unchecked box, so that the field would have 0 or 1, and not blank. Whereas a numeric field doesn’t have that requirement.

    I’m still thinking about a workaround for the radio buttons.
    Thank you!
    Ivy

    Hi,
    I did get the numeric fields to add and multiply. Thanks!

    I couldn’t get the checkbox fields to add. The checkbox values in the database look the same as the numeric field values, just 1’s instead of bigger numbers. Why doesn’t it work?

    How can I assign values to the radio buttons and just save those instead? A line of code in the attributes? I don’t think of radio buttons as multiselect. The reason I like it is because the participant can only choose one button. Team captain gets 25 points, teammate 5 points, individual 0 points.

    Thanks, Ivy

    Hi Roland,

    That’s interesting that someone else uses the Calculated Fields Form plugin.
    I have 2 questions:

    1) If I want to sum up a bunch of fields and multiply that by 10, can I just do *10? Or do I have to set up a numeric field [multiplier]?

    2) I have a similar problem as in-business. I have a list of checkboxes whose values are 1 if checked. I suppose I can even make them a different number when checked. And the numeric values can be added together.

    Now I also have a field with 3 radio buttons: team captain, teammate, and individual. I want to assign 25 points for a team captain, and 5 points for a teammate. Can I assign a value to the radio buttons (similar to the checkbox) so that I can carry the values over to a numeric calculation field? I’m ok with only saving the values. (I can convert them back to the options through Calculated Fields Form.)

    Thanks! The Numeric Calculation is a lifesaver.

    Thread Starter crowwoods1

    (@crowwoods1)

    Yes, I added the 3 fields to my database. That’s how come it worked initially. All the fields are numeric. All the input fields have a default of 0.

    There is no error in the addition in the log. After I saved the record, I get —
    PDb_Participant_Cache::refresh_cache: Refreshing Participants Database cache for cache group 0
    Is that ok?

    You mean the ‘numeric_sum’ field must be read-only or hidden? I didn’t before, but now that field is read-only. I added a default value of 0 for it too.

    The other puzzling thing is each time I deactivated it to edit the file, and then go and copy and rename and edit the file in my host directory, the total-field plugin file shows up as 2 files in wp, and I would to figure out which one to reactivate. Then I would activate one and see if that’s the right one. If I then delete the wrong one, both plugin files would be deleted. Is that related to what’s wrong? Should I edit it in the wp plugin editor instead?

    Thread Starter crowwoods1

    (@crowwoods1)

    I can’t seem to get your code working again. I am not testing any changes I made to your code. Can you test if your code still works?

    Thread Starter crowwoods1

    (@crowwoods1)

    I have renamed the file folder. The long name is what the compressed zip file from gist generated.

    I have disabled the cache in chrome and in wp, but numeric_sum is still not doing the sum. I’m just testing numeric_1 and numeric_2 again.

Viewing 15 replies - 61 through 75 (of 89 total)