1 2 Previous Next 17 Replies Latest reply on Jun 2, 2010 2:48 PM by TSGal

    Not Sure if a Bug, But Unabe to Set Fields from One Repeating Field to Another Repeating Field

    thomasfilemaker

      Summary

      Not Sure if a Bug, But Unabe to Set Fields from One Repeating Field to Another Repeating Field

      Description of the issue

      Not sure why you cannot set valaues from one repeating field to anther repeating field.Script below only sets value for first repeating field, but fails to set in repeating field 2 through 6.Two Fields:Field A with 6 repeating valuesField B with 6 repeating values Set B to A (Script)Set Field [ A, GetRepetition(B, 1) ]Set Field [ A-2, GetRepetition(B, 2) ]Set Field [ A-3, GetRepetition(B, 3) ]Set Field [ A-4, GetRepetition(B, 4) ]Set Field [ A-5, GetRepetition(B, 5) ]Set Field [ A-6, GetRepetition(B, 6) ] When you run this simple script, only the top line delivers the desired results.  The rest of the script, results in blank valuesfor Field A.  If I write a script that copies and pastes each individual repeating value, it results in transfering the values from Field B to Field A.But the "set" command does not. Why? 

        • 1. Re: Not Sure if a Bug, But Unabe to Set Fields from One Repeating Field to Another Repeating Field
          mrvodka

          Are you definitely specfying the repetition number in the repetition field during the selection of the target field?

           

           

          Also I may try a script like such instead since you are setting from one rep to other rep directly.

           

          Set Variable [ $i; 1 ]

          Loop

          Exit Loop If [ $i > 6 ]

          Set Field [ A [$i]; B [$i ] ]

          Set Variable [ $i; $i + 1 ]

          End Loop

           

          Make sure that you set the repetition field to $i when choosing field A as the target.

           

           

          Edit: Put in missing increment

          • 2. Re: Not Sure if a Bug, But Unabe to Set Fields from One Repeating Field to Another Repeating Field
            mrvodka

            Wait what version are you using? It seems like you are using an earlier version.

             

            Try:

             

            Set Field [ A, B ]
            Set Field [ A-2, B ]
            Set Field [ A-3, B ]
            Set Field [ A-4, B ]
            Set Field [ A-5, B ]
            Set Field [ A-6, B ]


            • 3. Re: Not Sure if a Bug, But Unabe to Set Fields from One Repeating Field to Another Repeating Field
              raybaudi

              Hi John

               

              ;) you missed something... ( increment $i )

               

              BTW I tried this:

               

              Loop
              SetField [ A[Let ( $i = $i + 1; $i )] ; B[ $i ] ]
              Exit loop If [ $i = 6 ]
              End Loop

               

              ... and works but ... it STOPS to work if you active the Script Debugger !!

               

              This seems to be a BUG ! ( Win and FMP 9 )


              • 4. Re: Not Sure if a Bug, But Unabe to Set Fields from One Repeating Field to Another Repeating Field
                mrvodka

                It seems to increment by 3 when hitting the Set Field step and then properly adds 1 when exiting the set field and performing the step.

                 

                P.S. Thanks for the earlier catch

                • 5. Re: Not Sure if a Bug, But Unabe to Set Fields from One Repeating Field to Another Repeating Field
                  raybaudi

                  I just tried that loop also on version 10 ( always Window platform ) .

                   

                  The script works but goes into an infinite loop with the debugger opened.

                   

                  May be that this bug is only on Windows ?

                  • 6. Re: Not Sure if a Bug, But Unabe to Set Fields from One Repeating Field to Another Repeating Field
                    mrvodka

                    Yes infinite because it never meets the: Exit loop If [ $i = 6 ] criteria. Instead if you use >= then it will exit the loop only setting the 4th rep.

                    • 8. Re: Not Sure if a Bug, But Unabe to Set Fields from One Repeating Field to Another Repeating Field
                      thomasfilemaker

                      Yes That works, Thanks. Also Have another question. Given a relationship that results in a value "r1" in a field "s" when a value "a" is matched with value "b", and a entire set of values is defined by this relationship for "r", is there any way to have  a different set of values "r2" for the same matched relationship where another variable is used to define the results "r2" using the same relationship, such as defining different "r" values using the same relationship, but having a different result dependent upon a another variable such as varying zip codes, for example?

                       

                      For instance:

                      'Pay Record' has a field where a supervisor picks a job description "Sweeps floor" in a lookup field "a" and this is matched with another field in a

                      'Job Description Record' where for every job: a, there is a corresponding job code for that job description: "b" and a resultant salary 'r1' for the value of 'b' as defined in a certain zip code 'z'.


                      If the salary 'r1" was the same for every zip code, a simple relationship can result in the value 'r1' when 'a' is paired with 'b'.

                       

                      'Sweeping floor' or 'a' is matched with the job code 'b', such as 82736, and the assigned payment, $35.00 or 'r1' is assigned for the value of 'a' and/or code 'b'.

                       

                      But if a new record is created where the final result of the payent for services, 'a' or 'b' and this is dependent on 'z' ( a different zip code), for instance, is there a way to have only one defined relationship, written such that the zip code is assigned at the creation of the new record, and the desired payment: 'r2' assigned when 'a' is matched with 'b'?  It seems simple to write a script that assigns the values for one zip code and then afterwards make a adjustment for the different zip code with either a new script, but can this be done with just one relational script?

                       

                      Error, I meant to type, one defined field, not one relational script.

                      • 9. Re: Not Sure if a Bug, But Unabe to Set Fields from One Repeating Field to Another Repeating Field
                        mrvodka

                        I dont quite understand what you are trying to do. Are you trying th have zipcode specific prices for jobs?

                         

                        Also you still have not stated your version.

                        • 10. Re: Not Sure if a Bug, But Unabe to Set Fields from One Repeating Field to Another Repeating Field
                          raybaudi

                          mr_vodka wrote:

                          Yes infinite because it never meets the: Exit loop If [ $i = 6 ] criteria. Instead if you use >= then it will exit the loop only setting the 4th rep.


                          Yes, but IF the script works w/o the script debugger and desn't work when the debugger is ACTIVE, I can say that this is a BUG of FileMaker.


                          • 11. Re: Not Sure if a Bug, But Unabe to Set Fields from One Repeating Field to Another Repeating Field
                            mrvodka

                            Indeed. It has to be based on an unwanted evaluation caused by the Data Viewer when running the step.

                            • 12. Re: Not Sure if a Bug, But Unabe to Set Fields from One Repeating Field to Another Repeating Field
                              thomasfilemaker

                              Yes, a field definition.  I thought I could define a lookup field populated with simple task's ' that a user would pick in a FM database, for example, called Work Files.  This choice in field 'a' would populate field 'b' that is a corresponding code 'b' [for example, a numeric code] that is always the same for each simple task 'a'.  'B' is set by a looked-up value from a related table in another FM Database [called Tasks]  that has in its records, fields a: tasks,  b: unique code for each task, and r1: payment for task 'a' and r2: payment for task 'a', etc... r3, r4, r5... Whereby each 'r' value being unique for each zip code 'z'.  The description of each task 'a' and the code for each task 'b' do not change.  The payment 'r', for each task 'a' changes as is dependent on which zip code, 'z' the task 'a' is done.

                               

                              I thought there was a way you could define a single field that would result in a defined 'r*' payment that is defined in every new record in Work Files, that allows the user to chose a task in a look-up field A in Work Files.  Field B, is populated as a result of a simple lookup field that is defined by a simple relationship, where A is matched in the look-up field A in Work Files and the field A in Tasks, the other Database in this example.  B is populated in Work Files by the simple relationship: when A:Work Files equals A:Tasks, then B: Tasks in the result in B:Work Files.

                               

                              For each B (job code), there is a unique R (payment) and for record in Tasks, there are many R's (payments) that can be defined and each one is unique for each zip code 'z' in Tasks.  Is there not a solution, i.e. one field definition 'R' (Payment)  in Work Files, that can be defined by a relationship of both a unique value 'a' and a unique zip code 'z'  ---  whereby the zipcode is chosen for each new record in Work Files, and the user then chooses a task which is unique for each record, and is chosen based upon the choice of the user, and the resulted payment is populated in a field in Work Files, that is based upon the relationships described above.  I am able to write a simple relationship that defines a field that populates the payment based upon a single zip code that never changes, and when the user chooses the task, the resulted payment is defined for the zip code that is the default zip code.  This is easy, and when the user changes the zip code in a record, I have used a external script written by a third party, that recalculates, the payment based on the changed zip code. So, in the end, I have accomplished this with two different operations, one being the relational look-up field and the second being a third party script, written to change the payment value, when the user changes the zip code away from the default zip code. 

                               

                              Can this result [unique payment in each record in Work Files] be written or defined by one operation, that is one defined field, so that when a user picks a zip code and task in Work Files, a unique payment is defined in the same file that is defined by the unique relationship between each task, zip code and payment?

                               

                              As for which program version of FM, I am using FM 6, 8, 9, and 11.  I have just begun to use FM 11 for the last week, and am trying to upgrade some older programs, and would like to do so and not be dependent on the third party plugins which are not at present compatible with FM 11. Operating systems: XP, Mac OS 10.6, Windows 7.

                              • 13. Re: Not Sure if a Bug, But Unabe to Set Fields from One Repeating Field to Another Repeating Field
                                TSGal

                                All:

                                 

                                I cannot replicate the problem with the Script Debugger active.  It works correctly every time using FileMaker Pro 10 and FileMaker Pro 11 running on Windows XP (SP3), Mac OS X 10.5.8, and Mac OS X 10.6.3.  My scripts are as follows:

                                 

                                Set Field [ B [ 1 ] ; GetRepetition ( A ; 1 ) ]

                                Set Field [ B [ 2 ] ; GetRepetition ( A ; 2 ) ]

                                Set Field [ B [ 3 ] ; GetRepetition ( A ; 3 ) ]

                                Set Field [ B [ 4 ] ; GetRepetition ( A ; 4 ) ]

                                Set Field [ B [ 5 ] ; GetRepetition ( A ; 5 ) ]

                                Set Field [ B [ 6 ] ; GetRepetition ( A ; 6 ) ]

                                 

                                ===========

                                 

                                Set Variable [ $i ; 1 ]

                                Loop

                                   Set Field [ B [ $i ] ; GetRepetition ( A ; $i ) ]

                                   Set Variable [ $i ; Value: $i + 1 ]

                                   Exit Loop If [ $i > 6 ]

                                End Loop

                                 

                                ===========

                                 

                                If you would like me to try this with another OS and/or FileMaker Pro version, please let me know.

                                 

                                TSGal

                                FileMaker, Inc.

                                • 14. Re: Not Sure if a Bug, But Unabe to Set Fields from One Repeating Field to Another Repeating Field
                                  raybaudi

                                  TSGal wrote:

                                   

                                  I cannot replicate the problem with the Script Debugger active.


                                  Hi TSGal

                                   

                                  to replicate the problem create a script like mine:

                                   

                                  Loop
                                  SetField [ A[Let ( $i = $i + 1; $i )] ; B[ $i ] ]
                                  Exit loop If [ $i = 6 ]
                                  End Loop

                                   


                                  1 2 Previous Next