AnsweredAssumed Answered

Populating Brought forward field and preventing deletion of records

Question asked by piaccounting on Jun 19, 2017

Hello

 

I am using filemaker to replace a PDF Form that is being used. The form is a Daily Takings Sheet that contained, amongst other the following, which are now fields within the solution:

 

Date (calculation)

Brought forward float

Income

Expenses

Net Movement (calculation)

Less Bankings

Carried forward float (calculation)

 

The date field for a new record is populated with the maximum date from the table plus 1, with no override. This is to ensure there will always be consecutive dates.

 

There are two issues I am looking for the best way to solve.

 

Firstly, when a new record is added I want the brought forward field to contain the carried forward float from the previous record. Secondly
I want to ensure that the only record that can be deleted is the last one.

 

 

I have the following script which seems to do the job for the former:

Set Variable [$Bfwd; Value:GetNthRecord (Daily Takings::Cfwd ; Get (RecordNumber) -1)]

Set Field [Daily Takings::Bfwd: $Bfwd]

 

However I want this to be executed when a new record is added but cannot see where to put it. The Layout Script Trigger of On Record
Load is not right as this obviously updates existing records. Following the example at Carrying over a finish time to the next record start time but adding 1 minute I used the OnObjectEnter script behind the first field of the form and adding the If statement of If IsEmpty (Daily Takings::Bfwd)

 

This does appear to do the job but my question is therefore is this the best approach?

 

My second question is about preventing the deletion of any record other than the last one. I have as yet not explored the security settings
but having read Preventing User Deletion of Records I think this may be the answer. Before doing so please can anyone advise whether this is the right place to achieve this or should it be done by an alternative method.

 

Thanks for your assistance as always.

 

UPDATE

Just got myself "the missing manual" and exploring the section on Security and privilege sets which after a bit of trial and error I think I may have got to work. But it's late in the day.

 

Have posted an update query at Restrict deletion to the last record of a table

 

Message was edited by: Dave Fields Been working through the issues and posted update as I've found out more.

Outcomes