dbTalk Databases Forums  

Problems updating calc field??

comp.databases.filemaker comp.databases.filemaker


Discuss Problems updating calc field?? in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
stephen.wallace@agmd.org
 
Posts: n/a

Default Problems updating calc field?? - 03-31-2007 , 02:26 PM






Hello,

I have a database that is a library management system. It does check
outs, calculates fines, etc. I put it together using FileMaker
Advanced 8.0

One problem that I am having is getting the fines to calculate
automatically. Actually, I can get them to calculate fine it's just
that I am having trouble getting them to update perhaps in a better
way.

I have my fines based on the return date of the book. I have the fine
done as an auto-enter option. I need to also be able to override the
values in certain occasions so that's why I don't have it as a strict
calc field. In order to get the fines to update, I have a script that
runs at the beginning on all books that are currently overdue whereby
the return date is inserted newly into the return date field which in
turn causes the fine field to auto-enter (or update).

Is there a better way of doing this which will allow me to make
modifications to the field?

Thanks,

Stephen


Reply With Quote
  #2  
Old   
Ursus
 
Posts: n/a

Default Re: Problems updating calc field?? - 03-31-2007 , 02:51 PM







<stephen.wallace (AT) agmd (DOT) org> schreef in bericht
news:1175369195.355649.54500 (AT) y66g2000hsf (DOT) googlegroups.com...
Quote:
Hello,

I have a database that is a library management system. It does check
outs, calculates fines, etc. I put it together using FileMaker
Advanced 8.0

One problem that I am having is getting the fines to calculate
automatically. Actually, I can get them to calculate fine it's just
that I am having trouble getting them to update perhaps in a better
way.

I have my fines based on the return date of the book. I have the fine
done as an auto-enter option. I need to also be able to override the
values in certain occasions so that's why I don't have it as a strict
calc field. In order to get the fines to update, I have a script that
runs at the beginning on all books that are currently overdue whereby
the return date is inserted newly into the return date field which in
turn causes the fine field to auto-enter (or update).

Is there a better way of doing this which will allow me to make
modifications to the field?

Thanks,

Stephen
I think an easy calculation (or two) might do the trick better.

Say you have a duedate field <date>
You calculate how many days the book is overdue
cDaysOverdue < Calculation ; number ; Get(CurrentDate)-duedate>
Set the calc to not store its result.
Now you can from this number calculate the amount of the fine. You can even
put it together in one field.

Let ( [
DaysOverdue = Get(CurrentDate)-duedate ] ;
Case ( DaysOverdue > 100 ; 100;
DaysOverdue > 90 ; 90;
DaysOverdue > 50 ; 50;
DaysOverdue > 1 ; 1;
0)
)

The lender has to pay 100 units when he is more then 100 days overdue
The lender has to pay 90 units when he is more then 90 days but less then
101 days overdue
The lender has to pay 50 units when he is more then 50 days but less then 91
days overdue
The lender has to pay 1 unit when he is more then 1 day but less then 51
days overdue
otherwise no fine

No need for intricate scripts here.

Keep well, Ursus




Reply With Quote
  #3  
Old   
Helpful Harry
 
Posts: n/a

Default Re: Problems updating calc field?? - 04-02-2007 , 01:54 AM



In article <1175369195.355649.54500 (AT) y66g2000hsf (DOT) googlegroups.com>,
stephen.wallace (AT) agmd (DOT) org wrote:

Quote:
Hello,

I have a database that is a library management system. It does check
outs, calculates fines, etc. I put it together using FileMaker
Advanced 8.0

One problem that I am having is getting the fines to calculate
automatically. Actually, I can get them to calculate fine it's just
that I am having trouble getting them to update perhaps in a better
way.

I have my fines based on the return date of the book. I have the fine
done as an auto-enter option. I need to also be able to override the
values in certain occasions so that's why I don't have it as a strict
calc field. In order to get the fines to update, I have a script that
runs at the beginning on all books that are currently overdue whereby
the return date is inserted newly into the return date field which in
turn causes the fine field to auto-enter (or update).

Is there a better way of doing this which will allow me to make
modifications to the field?
The usual solution is to use two separate fields - one normal field and
one Calculation field.
eg.
UserFine Number

CalcFine Calculation, Number Result, Unstored
= If (IsEmpty(UserFine),
{insert your fine calculation here},
UserFine
)

This CalcFine field will then display the UserFine if it has
user-entered data in it, otherwise it will display your normal
calculated Fine.

Put these two fields onto the Layout. Change the Field Format options
so that neither field allows user entry. Position the fields so that
the CalcFine field is directly on top of the UserFine field (ie. the
CalcFine field hides the UserFine field from being visible).

Now set the CalcFine field to act as a button that runs a script
something like:

If [Get(CurrentMode) = 1]
Go To Field [CalcFine]
Else
Go To Field [UserFine]
End If

This means that when the user click on what appears to be a single Fine
field the script will redirect them to either:

- the UserFine field when in Browse Mode to allow the
user to type in a override Fine

- the CalcFine field when in Find Mode to allow the
user to find records no matter whether or not the
UserFine field has been typed into.


You need to remember is to ALWAYS use the CalcFine field in your other
calculations, scripts and printouts.

The only real problem with this approach is that users can't Tab
through the fields to get to the "Fine" field - since neither of the
fields allows user entry, they don't appear in the Tab order.


Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.