10 Replies Latest reply on Jan 16, 2010 7:46 PM by RickWhitelaw

    Record ID numbers

    thumper

      Title

      Record ID numbers

      Post

      Hey everyone a small problem im having is this...

       

      im trying to figure out how i can show something like like this:

       

      you are viewing record 2 of 57

       

      "2" being the current record displayed and "57" beeing the total number of records..... im not new to programming at all but am a complete newbie to filemaker lol

       

      i would like it to be in a label as well.

       

      Thanks for any help is much appreciated.

       

       

      also im using FM pro advanced 9 and on windows vista.

        • 1. Re: Record ID numbers
          RickWhitelaw
            

          I use a custom function defined as : "#" & " " & Get ( RecordNumber ) & " " & "of" & " " & Get ( FoundCount )  . No variables defined. It can be placed on any layout and will return the current record number in the found set as well as the total number of records in the found set of the table referenced by the layout. If you don't have FMPA simply define a field the same way in each table you need. As well I use the arrow sets in FM Graphics Pack (?) and attach script steps (Go to first record, go to last etc.) to them and place the above mentioned field under the graphics. It works fine.

           

          RW 

           

          I should point out: this returns Record Number (place in the order of a found set) and NOT RecordID which is unique and does not change regardless of the found set. 

          • 2. Re: Record ID numbers
            thumper
               Thanks or the reply, i tested out your code but what im looking for is to display the same data that is shown in the status area of filemaker but without having to show the status area itself, is that possible?
            • 3. Re: Record ID numbers
              TSGal

              thumper:

               

              Thank you for your posts.

               

              No, you cannot put the calculation in the Status area.  However, the Status area in FileMaker Pro 9 already displays the current record number and the found set of records.

               

              One option is to hide the Status area and create your own "Status Area" on the layout that includes the calculation provided by RickWhitelaw.

               

              TSGal

              FileMaker, Inc. 

              • 4. Re: Record ID numbers
                thumper
                  

                ok you say the "RecordID" is unique and doesnt change regardless of the foundset, well i have a layout thats bassically my main animal display layout, but its a listview, and when clicked on a record it opens it up on another window in form mode. the code that was working for me before that i was told to use was:

                 

                • Set Variable [ $n; Value:Get ( RecordNumber ) ]
                • Close Window [ Current Window ]
                • Go to Record/Request/Page [ $n ] [ No dialog ]


                it was working fine , but i notice now it doesnt, i have added buttons that run scripts to show either only active males or only active females and a button that shows all records in database table.


                but if i change "RecordNumber" and replace with "RecordID" then it also just shows random records, i say random cause i cant identify the problem/pattern of whats going wrong. there has gotta be a simple solution or alternative way, maybe?


                here are the button scripts for the males, females and all records im using:

                 

                 

                Show all active females:

                 

                • Enter Find Mode [ ]
                • Set Field [ HP Main::Reptile Sex; "Female" ]
                • Set Field [ HP Main::Active Inactive; "Active" ]
                • Perform Find [ ]

                 

                show all active males:

                 

                • Enter Find Mode [ ]
                • Set Field [ HP Main::Reptile Sex; "Male" ]
                • Set Field [ HP Main::Active Inactive; "Active" ]
                • Perform Find [ ]



                show all active animals:

                 

                • Enter Find Mode [ ]
                • Set Field [ HP Main::Active Inactive; "Active" ]
                • Perform Find [ ]

                 

                 

                 

                 

                Thanks again, 

                 Justin




                • 5. Re: Record ID numbers
                  RickWhitelaw
                    

                  Thumper,

                   

                  I usually put the calculation field below the appropriate arrows grouped together and place the whole thing in the Header. Works well.

                   

                  RW 

                  • 6. Re: Record ID numbers
                    thumper
                       Thanks for the quick reply RW, but could you please explain what you mean a bit more, im still pretty new to filemaker.
                    • 7. Re: Record ID numbers
                      DLW-BPEX
                        

                      Rick,

                       

                      Just curious about a detail:

                      Is there any particular reason why you put the inter-word spaces inside their own quotes?

                       

                      e.g.,

                      & "of" & " " & Get ( FoundCount )

                       

                      ...instead of:

                      & "of " & Get ( FoundCount )

                       

                      I am not criticizing; just wondering (since this seems very meticulous on your part) whether there may be some SPACE-related gremlins to be aware of. (I know there can be with formatting, field names, and other things.) I have been incorporating spaces inside text strings with no (apparent) problems. But one never knows, eh?

                       

                      David 

                      • 8. Re: Record ID numbers
                        RickWhitelaw
                          

                        Create a calculation field in your table defined as I mentioned earlier. Get FM Graphics Pack if you don't have. It's free and available from Filemaker. Or you can use any symbols you want really. Choose  graphic symbols for each of First record, previous record, next record and last record. I use arrows. A left-pointing arrow with a "|" to the left for "First Record" . . . you'll find the right images. Drag or paste these symbols onto the header part of your layout. Set up each as a button with the appropriate script step  . . . go to first record, go to previous record etc. which are all available as script steps in the button setup dialog. For convenience, after you've arranged the buttons the way you want them to look, group them. Place the Record Number field just below the group of buttons. You now will have something that works just like the control in the status bar without having to open the status bar. You'll be able to move between records and the calc field will tell you something along the lines of "# 12 of 23" depending on the found set and where you are in the order of that set. You might, in some cases, want a fifth symbol . . . a file drawer perhaps . . . and attach the "Show all records" script step to it.

                         

                        Rick. 

                        • 9. Re: Record ID numbers
                          thumper
                            

                          im sorry Rick, the answer you provided a while ago was and still is working great, i came accross another problem but i posted in this thread by mistake thinking you were the one who helped me with this specific issue the first time, sorry for the confusion, and thanks again for the help, i reposted my problem in the correct thread this time

                           

                          http://forum-en.filemaker.com/fm/board/message?board.id=FM-en-4&thread.id=35661

                           

                           

                          Thanks,

                          Justin

                          • 10. Re: Record ID numbers
                            RickWhitelaw
                              

                            I should have added in the original reply that the calculation result is text. You must specify the spaces when you concatenate with "&" otherwise you end up with "#1of3" instead of

                            "#1 of 3". Also, if I didn't mention it yet (I can't see the post) the calculation should be unstored.

                             

                            RW