6 Replies Latest reply on Mar 7, 2016 9:26 AM by HenkSouren

    cannot find function 'last field in actual record'

    HenkSouren

      The function 'go to record->last->EXIT AFTER LAST' is very handy for looping through record sets. I tried to find a similar command for stepping through the various fields within a record. That at least needs something like 'field->last' or perhaps 'number of fields in record'.

      Could somebody help to find an adequate stop or turning point in my loop? Thanks.  

        • 1. Re: cannot find function 'last field in actual record'
          schwjm

          The FieldNames function will give you a list of all fields on a layout. There is a similar way to get a list of all fields in a table using ExecuteSQL. It is slightly different than looping over records. I'm not sure what you're trying to accomplish but it sounds like you're just trying to go through each field on a layout so this should work. You will have to loop through the list using a counter and GetValue, then read the value using GetField function and set values using Set Field By Name. Unfortunately this cannot be combined with Go to Field as there is no way to specify a field name by calculation in that script step.

           

          Hope this helps.

          • 2. Re: cannot find function 'last field in actual record'
            HenkSouren

            Thanks for the prompt answer. I never expected to find something in the design area. With the help of your suggestions i think i will manage; your 'unfortunately' remark should be a message for Filemaker. However, thanks a lot!

            • 3. Re: cannot find function 'last field in actual record'
              BruceHerbach

              If you are on a layout and want to go to a specific field,  give it an object name and use Go To Object[] script step.

               

              So what is it you are trying to do with your script?  For Set Field or Set Field by name,  the field does not have to appear on the layout.  In cases were I have to do fair amount of work on a record or a large record set,  I'll use a blank layout.  This speeds up processing time and can reduce the amount of data FileMaker server sends to the client.

               

              HTH

              • 4. Re: cannot find function 'last field in actual record'
                siplus

                fieldnames(Get ( FileName ); Get ( LayoutName )) will return you the names of fields that are in tabs and popovers, too.

                Maybe you don't want that to happen...

                 

                It's important to know - as other contributors have pointed out - what your goal is. You might be better served with exporting the record, specific fields, for example.

                • 5. Re: cannot find function 'last field in actual record'
                  DavidJondreau

                  Fields don't have a natural order, they're just fields. You may be trying to use a layout to set that order, and loop through the fields on a layout, but that's not really how FM works.

                  • 6. Re: cannot find function 'last field in actual record'
                    HenkSouren

                    So many reactions, beautiful, thanks.

                    The functionality i was looking for, ist quite simple. In my case, i was not thinking in 'views' or 'layouts'. On source-basis (see the table-relations scheme), a table is a 2-level matrix holding data, that can be worked on. On 'record' level -vertically- Filemaker offers adequate looping functions; why not on horizontal 'field' level too?

                     

                    Thanks to you all, I guess how i should address my 'problem' in an Apple way. The actual discussion may be closed.