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.

Name & Parameters: LastRepNumber ( repeatingField ; maxRepeat ) Description: Returns the number of the last not empty repetition, much like Last(repeatingField) returns its contents. Can be

Featured Replies

Name & Parameters: [color:red][big] LastRepNumber ( repeatingField ; maxRepeat ) [/big]

Description: Returns the number of the last not empty repetition, much like Last(repeatingField) returns its contents.

Can be used with both 7 and 8 version of FileMaker, but is most useful with 8, where fields can be reached specifying the repetition number by a calculation.

For example, to set the next empty repetition to "whatYouWant" you can use:

Set Field [repeatingField [LastRepNumber ( repeatingField ; 10 ) +1];"whatYouWant"]

(where repeatingField has 10 rep).

This function comes in hand also if you want to clear all repetitions.

A simple loop:

Loop

Exit Loop if [LastRepNumber ( repeatingField ; 10 ) = ""]

Set Field [repeatingField [LastRepNumber ( repeatingField ; 10 )];""]

End Loop

Sample Input:

LastRepNumber ( repeatingField ; 10 )

Results:

returns a number between 1 and 10 ( or "" if repeatingField is empty )

Recursive: yes

Formula:

/*

LastRepNumber custom function



Author

Daniele Raybaudi



Type

Recursive



Format

LastRepNumber ( repeatingField ; maxRepeat )



Parameters

repeatingField - any repeating field, or an expression that returns a reference to a repeating field.

maxRepeat - the number of repetitions assigned to repeatingField



Data type returned

number



Description

Returns the number of the last not empty repetition, much like Last(repeatingField) returns its contents.

Can be used with both 7 and 8 version of FileMaker, but is most useful with 8, where fields can be reached specifying the repetition number by a calculation.

For example, to set the next empty repetition to "whatYouWant" you can use:



Set Field [repeatingField [LastRepNumber ( repeatingField ; 10 ) +1];"whatYouWant"]

(where repeatingField has 10 rep).



This function comes in hand also if you want to clear all repetitions.

A simple loop:



Loop

Exit Loop if [LastRepNumber ( repeatingField ; 10 ) = ""]

Set Field [repeatingField [LastRepNumber ( repeatingField ; 10 )];""]

End Loop



April 27, 2006



*/



Case (

IsEmpty ( Last ( repeatingField ) ) ; "" ;

Last ( repeatingField )  = GetRepetition ( repeatingField ; maxRepeat )  ; maxRepeat ; 

LastRepNumber ( repeatingField ; maxRepeat - 1)

) 

Required Functions:

Author(s):) raybaudi

Date: 04/27/06

Credits:

Disclaimer:

FM Forums does not endorse or warrantee these files are fit for any particular purpose. Do not post or distribute files without written approval from the copyright owner. All files are deemed public domain unless otherwise indictated. Please backup every file that you intend to modify.

LastRepNumber.zip

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

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.