2 Replies Latest reply on Oct 4, 2013 10:42 AM by CampAdmin

    scripting help to replace field contents

    CampAdmin

      Title

      scripting help to replace field contents

      Post

           In our camper database we have fields for swim levels at the end of weeks 2, 4, 6, and 8. At the end of the summer I would like to take the last information and put it into a field labeled prior swim level to be ready for the next summer. How do I set up a script that will look at week 8 and if it's empty move to week 6 and so on to then put that info into the prior swim level field?

        • 1. Re: scripting help to replace field contents
          philmodjunk

               Use this calculation with replace field contents:

               Case ( Not ( Isempty ( YourTable::Week8 ) ; YourTable::Week8 ;
                           Not ( Isempty ( yourtable::Week6 ) ; YourTable::Week6 ;
                          Not ( Isempty ( yourTable::Week4 ) ; YourTable::Week4 ;
                          Week2 )

               And with certain data types for your weeks fields (such as number), you might also be able to use:

               Max ( YourTable::Week8 ; YourTable::Week6 ; YourTable::Week4 ; YourTable::Week2 )

               And you might also consider setting up a table of related records to use in place of these individual fields in order to gain more flexibility in your design.

          • 2. Re: scripting help to replace field contents
            CampAdmin

                 With your input above, I put together the following calculation for the updating of swim levels. Much simpler that what I was thinking I would have to do. Most importantly, it worked in my test database!

                 Thank you so much for your help.

                  

                 Case ( not (IsEmpty (${07 CAMPER DATABASE test}::swim wk 8 )); ${07 CAMPER DATABASE test}::swim wk 8 ; 

                 not (IsEmpty ( ${07 CAMPER DATABASE test}::swim wk 6 )) ;${07 CAMPER DATABASE test}::swim wk 6 ; 

                 not IsEmpty ( ${07 CAMPER DATABASE test}::swim wk 4 ) ;${07 CAMPER DATABASE test}::swim wk 4; 

                 not IsEmpty ( ${07 CAMPER DATABASE test}::swim wk 2 );${07 CAMPER DATABASE test}::swim wk 2;

                 ${07 CAMPER DATABASE test}::swim test )