william rock
asked on
Moving Data from one Repeating field to another Repeating field
I had this question after viewing Filemaker repeating field problem.
The issue is with Filemaker Repetition fields. In a Contacts file, I wish to place the entered value of the field "DP" in the repetition corresponding to the day of the week in the field, "DP Day", based on the value present in any repetition of the field"Day".
Three fields: Field 1. is "DP" ~ a single entered value;
Field 2 "Day" ~ is a Text [7] repetition field ~ each repetition can contain blank or numbers (1 2 3 4 5 6 7 ) corresponding to the day of the week.
Field 3 "DP Day" ~ is a Text [7] repetition filed ~ contains the value of "DP" in the repetition corresponding to the day of the week.
e.g. If Field 1 - "DP" ='s 100; and Field 2 -"Day" contains (blank, 3, 7, blank, blank, blank, 4) in the repetitions; The resulting values in Field 3 - "DP Day" should result in the values (blank, 100, 100, blank, blank, blank, 100)
Looking for the equation that will result in the above solution.
Thanks for any thoughts on this.
Bill Rock
The issue is with Filemaker Repetition fields. In a Contacts file, I wish to place the entered value of the field "DP" in the repetition corresponding to the day of the week in the field, "DP Day", based on the value present in any repetition of the field"Day".
Three fields: Field 1. is "DP" ~ a single entered value;
Field 2 "Day" ~ is a Text [7] repetition field ~ each repetition can contain blank or numbers (1 2 3 4 5 6 7 ) corresponding to the day of the week.
Field 3 "DP Day" ~ is a Text [7] repetition filed ~ contains the value of "DP" in the repetition corresponding to the day of the week.
e.g. If Field 1 - "DP" ='s 100; and Field 2 -"Day" contains (blank, 3, 7, blank, blank, blank, 4) in the repetitions; The resulting values in Field 3 - "DP Day" should result in the values (blank, 100, 100, blank, blank, blank, 100)
Looking for the equation that will result in the above solution.
Thanks for any thoughts on this.
Bill Rock
ASKER
Thanks a great deal Will. I'm not a good FM programmer (I own a wholesale cheese business in Wisconsin and have self learned just enough to get by beginning back when Apple owned FM.
I need the script to first look at Day and if it finds a value ( 1 through 7) in any one or more of the repetitions, to then put the value of DP in the appropriate repetition (1 through 7) in DP Day.
If the script did this, I'd be most grateful.
I need the script to first look at Day and if it finds a value ( 1 through 7) in any one or more of the repetitions, to then put the value of DP in the appropriate repetition (1 through 7) in DP Day.
If the script did this, I'd be most grateful.
There was a typo in my original script steps above where I wrote:
Set Field [ tablename::DP Day [3] ; Case( not isempty( GetRepetition( tablename::DP Day ; 3 ) ) ; tablename::DP ) ]
Instead of
Set Field [ tablename::DP Day [3] ; Case( not isempty( GetRepetition( tablename::Day ; 3 ) ) ; tablename::DP ) ]
I've edited the original comment to include the correction in both script variations.
By the way, FileMaker is still wholly owned by Apple but only in the last couple of years has Apple been advertising the fact with "Filemaker, Inc. - A subsidiary of Apple, Inc." on the larger logos. I've been using FileMaker since 1987 when it was FileMaker II (no "Pro") and recently found some files that I created with that version!)
Set Field [ tablename::DP Day [3] ; Case( not isempty( GetRepetition( tablename::DP Day ; 3 ) ) ; tablename::DP ) ]
Instead of
Set Field [ tablename::DP Day [3] ; Case( not isempty( GetRepetition( tablename::Day ; 3 ) ) ; tablename::DP ) ]
I've edited the original comment to include the correction in both script variations.
By the way, FileMaker is still wholly owned by Apple but only in the last couple of years has Apple been advertising the fact with "Filemaker, Inc. - A subsidiary of Apple, Inc." on the larger logos. I've been using FileMaker since 1987 when it was FileMaker II (no "Pro") and recently found some files that I created with that version!)
ASKER
I'll work on this tonight. Thank you.
I think I was on a 512E...
br
I think I was on a 512E...
br
ASKER
Thanks Will - Good job. Most appreciated.
Bill
Bill
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If ( not is empty ( tablename::DP )
Set Field [ tablename::DP Day ; Case( not isempty( GetRepetition( tablename::DP Day ; 1 ) ) ; tablename::DP ) ]
Set Field [ tablename::DP Day [2] ; Case( not isempty( GetRepetition( tablename::Day ; 2 ) ) ; tablename::DP ) ]
Set Field [ tablename::DP Day [3] ; Case( not isempty( GetRepetition( tablename::Day ; 3 ) ) ; tablename::DP ) ]
Set Field [ tablename::DP Day [4] ; Case( not isempty( GetRepetition( tablename::Day ; 4 ) ) ; tablename::DP ) ]
Set Field [ tablename::DP Day [5] ; Case( not isempty( GetRepetition( tablename::Day ; 5 ) ) ; tablename::DP ) ]
Set Field [ tablename::DP Day [6] ; Case( not isempty( GetRepetition( tablename::Day ; 6 ) ) ; tablename::DP ) ]
Set Field [ tablename::DP Day [7] ; Case( not isempty( GetRepetition( tablename::Day ; 7 ) ) ; tablename::DP ) ]
End If
What this does is check each repetition of tablename::DP Day and if it finds a value, it replaces it with the value entered in tablename::DP
Note that you specify the Repetition being set in the Set Field dialog at the bottom of the Specify Field dialog.
It's also possible to do this with a $Counter variable and a loop that exits after 7 repetitions but it would be about the same lines of code.
If ( not is empty ( tablename::DP )
Loop
Set Variable [ $i ; $i + 1 ]
Exit Loop If [ $i > 7 ]
Set Field [ tablename::DP Day [$i] ; Case( not isempty( GetRepetition( tablename::Day ; $i ) ) ; tablename::DP ) ]
End Loop
End If
In this case there is just one Set Field statement that uses the declared Script Variable $i to determine the field repetition to look at and act upon. ("i" stands for increment)