Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7468 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted

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

Posted

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

Posted

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,

  • Newbies
Posted

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

Posted

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

Posted

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)

Posted

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

This topic is 7468 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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