Upsert Plugin Question

emcguire

Member
I have the upsert plugin updating a field in another table. That field is an integer. I would like to increase that integer by 1 (+1) every time the plugin is ran. Is that possible with the upsert plugin?

I have the plugin successfully updating the table, but I cant seem to figure out if it would be possible to increase the value by 1 each time.

just FYI: this is an "approval" application. reps put in an account, then each rep has the ability to "approve" that account. So, after each rep approves the account, the amount of reps that have approved it increases (the field I'm trying to update and increment). Once every rep approves the account, I will compare the number of total reps to that field and once they are equal the account is approved by all reps and now is "claimed" by the rep that put it in.
 
Unfortunately it looks like that wouldn't be possible, as we quote the value ...

Code:
$fields[] = $k . ' = ' . $upsert_db->quote($v);

... so you can't use something like a key of 'foo' and value of 'foo + 1'.

In order to be able to do that, the plugin would have to have an extra setting on the popup for the key/value pairs, specifying whether to quote the value or not. Like we do on (say) the pre-filters for lists, where have the option to treat the value as quoted text, eval'ed PHP, unquoted text, etc.

So to do what you need, you'd need to do it yourself in a PHP form plugin. Or pay us a few bucks to add the option to the upsert plugin.

-- hugh
 
Thanks Hugh!

That's what I thought. I originally tried to do it in the PHP form plugin but my code wasn't working and I came across the Upsert and thought that might be an easier and cleaner option. If I can't get the coding figured out in the PHP form plugin, I may get back to you on adding that option in the Upsert. I need to get this application to work somehow eventually. Thanks for your help!
 
I've finished my updates to the upsert plugin, but need to test them for a while before I commit to github.

-- hugh
 
Hugh, You are the man. just FYI, I went ahead and installed it on my application (just to see) and it works (it is not a published app yet), So when you commit it, let me know and I will update it. Thanks Again!
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top