Philip Sommers Posted December 7, 2007 Posted December 7, 2007 Hello, all: I have a repeating field (DBCR Number) with 100 repetitions. In a second table, I have another repeating field (DBCR Mod), also with 100 repetitions. I want to write a script that copies the data from all of the repetitions in DBCR Number to the corresponding repetitions in DBCR Mod. I have tried using Set Field and specifying "100" for the repetitions of the target field DBCR Mod, but it only changes the value of the first rep. Can someone show me how to do this? Thanks in advance ...
Søren Dyhr Posted December 7, 2007 Posted December 7, 2007 Portals not repeaters right?? Here should be plenty to go on for the skilled, please note the comments comes in reverse order, start with the last first and then worm you to the first shown: http://blinkerfish.blogs.com/__fmcollective_old/2007/04/creating_multip.html --sd
comment Posted December 7, 2007 Posted December 7, 2007 To do exactly what you described, you will need to use 100 SetField[] steps. There may be other ways to achieve your goal, but you haven't told us what that is. For example, do you need to do this in one record at a time or in all records, is this a one time modification or an everyday action, why does the same data need to be stored twice - in other words, we need to know the context and the purpose in order to give more intelligent advice.
Philip Sommers Posted December 7, 2007 Author Posted December 7, 2007 SD and Comment: Thanks for the quick replies. It needs to happen to on a single-record basis, but it will happen every time a new record is created. The DBCR Mod field will be editable by a privilege set that is not allowed to edit the DBCR Number data. The DBCR Number is sort of like an "as-designed". The DBCR Mod is like "as-built".
Philip Sommers Posted December 7, 2007 Author Posted December 7, 2007 Comment and SD: OK, I figured it out. Haven't worked alot with repeating fields until now. Comment, you were right about the 100 set field steps. I also had something broken in one of my relationships that I didn't see until I stepped through the script. Thanks for all of your help ...
Søren Dyhr Posted December 7, 2007 Posted December 7, 2007 As long as you make it similar to this: Set Variable [ $row; Value:1 ] Loop Set Field [ Untitled::repeatB[$row]; Untitled::repeatA[$row] ] Exit Loop If [ $row=100 ] Set Variable [ $row; Value:$row+1 ] End Loop That being said is copy'ing, not a sign of a properly structured solution - with relational databases are the goal to have data atomicly stored in just one location, from where it then is referenced. Syncronizations like this are usually attempted prevented. --sd
David Jondreau Posted December 7, 2007 Posted December 7, 2007 To do exactly what you described, you will need to use 100 SetField[] steps. One Set Field step nested in a Loop is all he needs. Repetitions can be set by calculation.
comment Posted December 7, 2007 Posted December 7, 2007 To me that's still 100 steps, only automated. In any case, if this is only for setting the field to some initial values, a lookup should do just fine.
Recommended Posts
This topic is 6197 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 accountSign in
Already have an account? Sign in here.
Sign In Now