Forum

Thread tagged as: Problem, Add-on-development

Discrepancy between DB and text field.

Hi guys,

I'm trying to build an app (based on the Members app) where you can assign "hours" to a client, and then log "activities" in the back end that subtract from the hours count.

So far, all going well! The problem I'm experiencing is that, when adding a log and hitting "Save changes" on the Member, it adds the log and subtracts the time from the available hours as expected, but it doesn't represent that change in the "available hours" text field in the back end until I go back to the full Members listing and then revisit the client.

Any ideas?

Harry Ray

Harry Ray 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

How is this all implemented?

It's implemented through a Perch App that is basically a bespoke version of the Members app.

The "log", when added, calculates the "availableHours" column (for the member it was added to), minus the "timeTaken" column of the log that was added, and updates the "availableHours" column accordingly.

"availableHours" pulls through into an "Available Hours" text field on the 'Edit Member' screen. This needs to be a text field, because this app is built to cope with 'Support Accounts' that clients can buy hours for. We need to be able to access the field and update it whenever we want.

Currently, I can add hours through the text field into the "availableHours" column, and that functionality works just fine. I can add a support log, and have the app correctly calculate the remaining hours available. However, it doesn't update the "Available Hours" text field until I exit to the Member listing, and then return to the Member.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok. I'm not sure I can really help with your custom app. I've got no way of knowing how it's working, so am not in a position to offer suggestions.

The question I'm really asking is "do you know of any reason in Perch that the CMS text fields could not match up with the Database values they pull from?"

Drew McLellan

Drew McLellan 2638 points
Perch Support

In Perch, no. But in your custom app there could be any number of reasons. It's a bit like saying "imagine some code. Now tell me why it's not working".