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.

Set Repetition based on another field value?

Featured Replies

  • Newbies

I'm certain I'm just missing something but how do I set a specific repetition in field1 based on the value in field2? In other words if field2 contains 6 I want to set repetition#6 in field1 to value X.

I've browsed this board and searched docs/etc. but all I've found is the Set Field command which requires a hard-coded repetition #. I could make that work with a brute force sub-script but I'm certain there's a better way and I'm just being an idiot.

Thanx!

CharlieD

I was wrestling with this the other day and concluded that that's what we're stuck with. I also couldn't find a way to set the repetition outside of hard coding it. Pitty, because a repeating field could make a darn fine array variable otherwise.

I'll be more than happy if someome can tell me I'm wrong. (Act fast -- I don't often make this offer. smile.gif )

Dan

Does this also mean that if the value in field 2 contains 5, you would like to set repetition 5 equal to X?

The only way I have found to do this is to use the example plug-in that comes with Developer 7, also available for download at www.databasepros.com, to run a script on exit from field 2, which will set the correct value(s) for you.

If you'd like I can post a sample file.

Best regards,

Heres the file for anyone interested. It's a little clunky but I believe it does what your asking for.

SetRepetition.zip

  • Author
  • Newbies

Thanx for the file. I think I wasn't clear enough in my original posting so sorry to have bothered you. The "X" I was referring to was really an x...as in any random value not a literal X. : )

The core logic works and is the brute-force method I was trying to avoid implementing. I also agree with one of the earlier responders...if they ever implement a real SetRepetition function then repeating fields would be great general purpose arrays.

For now I'll make a brute-force script that encodes the rep # and value in the parameter and dupe it as needed.

Thanx.

CharlieD

Hi,

May be this quick tip might help too...

You'd need to reverse the process in case you want to automatically delete the previously set reps. This would require a second trigger in some place, that's all.

SetRepX.zip

And now, re-reading this thread, of course it is possible and was more than once mentionned in this Forum.

Check this thread for more than one alternative...

related thread

Michael Myett said:

Does this also mean that if the value in field 2 contains 5, you would like to set repetition 5 equal to X?

The only way I have found to do this is to use the example plug-in that comes with Developer 7, also available for download at www.databasepros.com, to run a script on exit from field 2, which will set the correct value(s) for you.

If you'd like I can post a sample file.

Best regards,

If I understand correctly what is being asked here, there is a much easier (with no plugins) way of doing it:

FMP7 has a new calculation: Get ( CalculationRepetitionNumber )

( rather than get(activeRepetitionNumber) -- useful in script))

What this will do is return the number of the repetition in a calculation.

You could use it in a calculation on a repeating field as such:

case(Get ( CalculationRepetitionNumber ) = extend(field 2),"X")

Edit: Note that this will work if the calculation is an actual calcuation (not an autoEnter Calcuation)

If you want the user to be able to edit the values in repetitions then what you need is three fields:

RawData: text field with 10 repeating values

RepNumber: Number field

ModifiedData: Calculation field of type text with 10 repetitions. Calculation: if(Get ( CalculationRepetitionNumber ) = extend(RepNumber); "Whatever"; GetRepetition(RawData;Get ( CalculationRepetitionNumber )))

If you want to give the appearance that the modified data an editable field (ie non-calculated field), you coul place the ModifiedData field on top of RawData with a opaque fill. Turn off "Allow field Entry" on the ModifiedData field. Now when you click on the repetition it go to the field belowit (field RawData)

Very nice.

I thought of another way to do this via scripts, which is the setting I originally needed it it. I'm surprised I didn't think of this sooner -- it is very low-tech. If you issues a 'Go To Next Field' command and you are in a repeating field you actually go to the next repetition of that field. So just by looping and counting you can set up an array as you like.

The downside is that you have to have the field visible on the layout in order for this to work, so you can either set up a developers layout, or create an 'invisible' field on a real layout.

See attached.

Dan

test rep set.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.