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

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

Recommended Posts

Posted

I need to input information into a repeating field based on a counter value. Right now I am using SetField["PurchaseOrders::QTY", GetRepetition ("QTY", "Counter")]. The problem is that I need to make the exact same repeating field in PurchaseOrders reflect the value of "QTY", "Counter". I know that you can specify the repeating field number of "PurchaseOrders::QTY" in script set up so it looks like SetField["PurchaseOrders::QTY"-2, <--- that does it...but I want to say "counter" instead of -2....I want to be able to control this with a variable.

Any suggestions would be helpful

Posted

CMON, all these smart people and yet no one can tell me yay or nay if it's possible to specify a target repetition of a field based on a value. My only solution is 20 if statements...

If ["counter = 2"]

set field ["blah"-2, "stuff"]

end if

If ["counter = 3"]

set field ["blah"-3, "stuff"]

end if

This works great if you dont have multiple items per. Copy, but unfortunately I have 5 items per if statement and 40 possible repeating fields. This script is going to be a mess. I need some help.

Frank

Posted

You can't. There's not an easy way to dynamically specify a field or repetition number when indicating a destination field (for set, go to.., etc). It's a huge pain. You can try (possibly nested) IF statements to set the correct field or a different script for each case.

Or (just remembered this)

I once got it to work by creating a special layout, setting the tab order, then using a loop to go to next field, go to next field, etc... the right number of times to end up where I wanted, then set the field I was in (by not specifying a destination field).

Jeff

Posted

Thank you. If anyone ever does beta testing for FM 7.0+ or anything like that, please suggest open programming code, so that we can make our own logical script additions. You guys rock.

Posted

Repeating fields really suck for this kind of stuff. They remain in FMP mainly for backwards compatibility (though they can be useful for displaying data, but not storing it).

It should be done relationally.

Posted

jscooper said:

You can't. There's not an easy way to dynamically specify a field or repetition number when indicating a destination field (for set, go to.., etc).

Not true. There are several ways of doing this.

1. Applescript.

2. Using a lookup method. I'm not going to try to explain it in detail right now, but people have been directly addressing repeating field cells since the days of 2.1. Basically you need to set up a another repeating field that holds the record ID combined with the repeat number. Then you set put your source data in a global, put the target rep number in another field, and trigger the lookup.

3. The looping script method. Set global, whichRep. Loop, go to next rep. If current rep = global, insert value.

It should be easier. But it CAN be done.

Posted

True, in fact the looping method I mentioned was from a 2.1 database I made way back when.

Doing some sort of lookup never occured to me though. Vaughan's right though, unless you have a real specific reason for using repeating fields, relational usually works better. Though it'd be nice if portals could go horizontally, or in a grid.

Jeff

This topic is 7581 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.