Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

"Compacting" repeating fields

Featured Replies

Good afternoon,

(I'm not sure this is the right section, but seemed the most appropriate that I can find.)

I have three fields ("type", "client", and "expense"). Each field has 10 repetitions. I have a button that will clear out the n'th repetition of all three fields - so the whole line is blanked should the user need to do so.  What I would like to do is then remove that empty line, moving all the data from all subsequent fields "up" one. (n-1), thus keeping the list compact and free of blank lines.

I did write a loop that did this, but it was very clumsy, and thought that somebody may know of a cleaner way using existing functions and smarter (than my-) logic to achieve this please?

Many thanks in advance if anybody has any ideas.

Greg 

I would suggest you solve this by changing your structure: instead of repeating fields, use records in a related table. Then you can simply delete a record and the gap in the portal showing the related records will close automatically, without you having to do anything.

Not to mention numerous other advantages offered by having a proper relational structure.

  • Author

Hi Comment,

Thank you, and yes, you are right - a portal would be a better approach.  
The problem here was becoming more theoretical and experimental to me now than anything. :)

Cheers,
Greg

Well, in theory, assuming that any repetition of the three fields would be either empty or non-empty in all three of them, you could gather the remaining values into 3 variables using the List() function (which skips empty values). Then loop populating all repetitions  with the corresponding value from the corresponding variable.

But really, this is not the best way, and hasn't been ever since Filemaker went relational in version 3 (1995).

  • Author

Hi Comment,

Thank you. Loud and clear. lol

I am using the portal method and it works fine, but I was revisiting another part of a solution (I inherited) that had the repeating fields and was probably just wasting time trying to find a solution to it.
Let's close this one. I shouldn't be wasting time anyway.  :)

Thanks again.
Greg

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.