Calculated Field?

For HanDBase related topics that are not specific to one platform.

Calculated Field?

Postby Reggae » Tue Mar 16, 2010 5:02 am

I hope I can explain this ....

I want to set a field to a value but in order to do this I need to check its current value first and perform some validation based on the difference between the current and new value. Is this possible?

Thanks


Reggae
Reggae
 
Posts: 26
Joined: Tue Oct 06, 2009 3:37 am

Re: Calculated Field?

Postby dhaupert » Tue Mar 16, 2010 11:17 am

Hi Reggae,

Thanks for your question. I'm not sure I understand exactly what you mean. Would this entail tracking the difference between a previous value in a particular record and the new value in the same record? If so, not sure that can be done. We can definitely track the differences between the same field in different records, and we can track the differences between different fields in the same record, but unfortunately not both the same field and the same record.
dhaupert
 
Posts: 4111
Joined: Tue May 26, 2009 11:51 am

Re: Calculated Field?

Postby Reggae » Tue Mar 16, 2010 1:18 pm

Hi Dave,

Thanks for the reply. Yes it does require tracking the difference in value of the same field on the same record. It's because the changing of the value carries a cost and a check has to be made on another, parent, record to ensure the cost can be met and if not flag an error and prevent the change.

Its a long time since I did any programming, when I did I would have handled this sort of validation using a before and after image of the record and only performing the update once I'd done the validation, but this was not on a handheld database application which is a new area for me.

I want to buy HandBase for an app I've in mind and I highlighted this as a possible problem area. I will try and think of another way I might do this using Handbase and if you have any further thoughts in the meantime they'd be very welcome!

Many Thanks

Reggae
Reggae
 
Posts: 26
Joined: Tue Oct 06, 2009 3:37 am

Re: Calculated Field?

Postby dhaupert » Tue Mar 16, 2010 2:09 pm

Hi again,

What it sounds like you should be consdering in the relational aspects of a database. For example, let's say I was tracking stock values of different companies. If I wanted to know what the change between one day and the next, I'd create a related table of values. This table would use a link/linked field pair, and then have a date, time, and a stock price. Now every time I want to update the stock price, I add a related entry and put the values in. then you can have fields that account for the change from the previous record however you want.

Something to consider...!
dhaupert
 
Posts: 4111
Joined: Tue May 26, 2009 11:51 am

Re: Calculated Field?

Postby curtterp » Wed Mar 17, 2010 5:19 am

This might be a solution for you.

Why cant you put another field in called 'New Value'. Have the field blank until you put in a value you want to change the original field to. Then perform your cost calculation, and if it meets the criteria, then put that into the original field and blank out the new value field. If it fails, then blank out the new value and leave the original alone.

I am trying to get ready for work, so I don't have a chance to check to see if this is possible right now, but I thought I would put that out there as an idea.

Have a good day
Have a good day

Curt
I am not a DDHSoftware employee, just a long time HanDBase user.... from Palm to Windows Mobile to Android, to iOS. Thanks to DDH, the database files transferred to each platform without a problem.
curtterp
 
Posts: 681
Joined: Tue May 26, 2009 6:41 pm
Location: Northern IL

Re: Calculated Field?

Postby Reggae » Wed Mar 17, 2010 8:29 am

Thanks both of you for the suggestions.

Dave - that would work fine for a field like you've mentioned and I'll probably use it for another field elsewhere in the database.
I'm reluctant to use it in this case because the change the user makes may be illegal and I don't want the user to be allowed to do it if thats the case.

curtterp - for this particular field that sounds like it might work.

How/when would the cost calculation be executed/triggered?. I'm afraid I've no experience of handbase at all so far.



Thanks


Reggae
Reggae
 
Posts: 26
Joined: Tue Oct 06, 2009 3:37 am


Return to HanDBase General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron