Dimitri Posted February 9, 2021 Share Posted February 9, 2021 I use Filemaker Pro 5.0 I am struggling with running count for a specific value What I want to do Each time I create a new record a specific number is given to that record (in my case a B number , for example B0100) I've put a running count on that field , so it increase by 1, 2, 3 etc ... When I want to create a new record with B0101, I want that the running count is restarting with 1. How is this possible in Filemaker 5.0 ? Quote Link to comment Share on other sites More sharing options...
AHunter3 Posted February 10, 2021 Share Posted February 10, 2021 I don't understand what you want it to do. If the "B" number goes up by one for each new record, B0100 is immediately followed by B0101. If you have a separate field that is "running count", it would have a 1 in it if it started out with 0 for B0100. It would have a 2 in it if it started out with 1 for B0100. If you want it to start over with 1 after only making one record (from B0100 to B0101 sure looks like only one record), what would it ever be a running count OF?? Quote Link to comment Share on other sites More sharing options...
Dimitri Posted February 11, 2021 Author Share Posted February 11, 2021 If I create a new record I give it a number (In my case B0100) , this number repeat for several records but need to have a running count per B0100. (B0100 / 1 , B0100 / 2 , B0100 / 3 , ... After the B0100 number is done (this number is used as a requestnumber and put in the FM database) I want when I go to B0101 the running count starts over at 1 and counting (Running count) until I go to B0102 ... In other FM databases you can restart the running count. But in FM 5.0 I don't have this option. Does a specific calculation would support here? Many thanks for your reply Quote Link to comment Share on other sites More sharing options...
AHunter3 Posted February 12, 2021 Share Posted February 12, 2021 The field that contains the B0100 or B0101 or whatever: I am going to nickname it BNumber for purposes of this example. Make a selfjoin relationship of BNumber to BNumber. Now create a calc field defined simply as 1, let's name it One. Now create a calcfield defined as Sum (SelfJoin::One)+1, and let's call it FetchCount. Finally, define your Count field. Set it to auto-enter the value 1, and then *also* set it to look up its value: look up FetchCount from SelfJoin. Result B0101 (first record) Count = 1 B0101 (second record) Count = 2 B0101 (third record) Count = 3 B0102 (fourth record) Count = 1 etc Quote Link to comment Share on other sites More sharing options...
Dimitri Posted February 12, 2021 Author Share Posted February 12, 2021 Hi, I've putted in FM 5.0. And it works ! <Super thanks ! Can you advise me when I duplicate records, when I duplicate a record the Count don't change automaticaly... Many thanks Quote Link to comment Share on other sites More sharing options...
AHunter3 Posted February 12, 2021 Share Posted February 12, 2021 Script the duplication of records instead of using the native Duplicate function. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.