问题
My end goal is to have a box change color when the last 3 records input into a field (based on the time of input) in FileMaker achieve a certain criteria (ex. variance < 2). I would like to know how to make this happen, or how a calculation/script can be written to only look at the last 3 records.
回答1:
There are several ways you could approach this. A simple one would be to use a script to:
- Show all records in the given table;
- Unsort them (assuming they were entered in chronological order; otherwise sort them by creation timestamp);
- Omit all records except the last three;
- Get the value of a summary field defined as Standard Deviation of your value field;
- Set a global variable/field to the square of the returned value.
Then use the global variable/field to conditionally format your "box".
If you don't want to use a script, you will have to define a relationship in order to get the last three values in the table, regardless of the current found set and/or sort order. Or you may use the ExecuteSQL()
function for this.
来源:https://stackoverflow.com/questions/43793152/perform-analysis-on-last-three-values-of-a-filemaker-dataset