8 Replies Latest reply on Feb 10, 2010 9:35 AM by philmodjunk

    Look at another field

    tmack2

      Title

      Look at another field

      Post

      I have a scripted button that will enter data from field 1 into field 2 if field 2 is empty.

      If field 2 contains data from field 1 and I press the button, a message shows, delete data from field 2, yes, no.

       

      I have a second button that will enter data from field 3 into field 2. If button 2 is clicked the same will happen as with button 1.

       

      I want to look to see if field 2 holds data from field 1 0r 3 so I can offer another choice.

       

      somthing similiar to this,

       

      If IsEmpty (field1)

      Set Field (field2;field1)

      Else

      If Not IsEmpty (field2)

      Show message: choice 1 = delete data, choice 2 = cancel

      Else

      If,

      HERE IS WHERE I GET LOST! SOMTHING LIKE, 

      else if field 2 is equal to field 3, show message: choice 1 will replace data in field 2 with data from field 1, choice 2 will cancel

       

      windows 7

      filmaker 10 

        • 1. Re: Look at another field
          tmack2
            

          Am I not clear as to what I want to do? Is this possible?

           

          • 2. Re: Look at another field
            philmodjunk
               Try posting an example with actual values and field names. Your first post contains what appear to be contradictions in terms of what you want. (If field 1 is empty copy its contents to field 2?!!)
            • 3. Re: Look at another field
              tmack2
                

              Button 1:" SAME AS CLIENT" runs the script below.

              Button 2: "SAME AS HOME"  runs a similair script.

               

              What I want to do is create a script that will check the field, "Mailing _Address" of the Spouse.

              If it is empty insert the Client Mailing Address info.

              If it contains the Client info and the button is clicked a second time, show a message with a choice to delete or cancel. (button 1 does this now)

              Button 2 runs a similiar script that inserts the Home address info of the Spouse in to the mailing address field.

               

              I want to check the field, (Mail_Address) to see if it is empty or contains the client address or the spouse home address. With this information I can better direct the user with an information message.

              Example: the field contains the spouse home address info. Button 1 is clicked. The message would read, Are yo sure you want to replace the current mailing address information with the clients mailing address information?

               

              The code below is similiar to what I am trying to do

               

               

              IF [IsEmpty ( Spouse::Mailing_Address )]

              SetField [Spouse::Mailing_Address;Client::Mailing_Address]

              Else

              If [Not IsEmpty (Spouse::Mailing_Address)]

              Show Custom Dialog

              If [Get (LastMessageChoice)="1"]

              SetField[Spouse::Mailing_Address;""]

              Else

              If [AND THIS IS WHERE I NEED HELP]

              SetField (Spouse::Mailing_Address;Client::Home_Address

              • 4. Re: Look at another field
                philmodjunk
                  

                I still can't tell from your description, what fields you need to compare in that last step where you need help. You have three address fields: Spouse::Mailing_Address, Client::Mailing_Address and Client::Home_Address in your script.

                 

                I'm guessing that this might be what you need here but could be completely mistaken:

                 

                (Note use of "Else If" to simplify the script a bit...)

                 

                IF [IsEmpty ( Spouse::Mailing_Address )]

                  SetField [Spouse::Mailing_Address;Client::Mailing_Address]

                Else If [Not IsEmpty (Spouse::Mailing_Address)]

                  Show Custom Dialog

                  If [Get (LastMessageChoice)="1"]

                    SetField[Spouse::Mailing_Address;""]

                  Else If [Spouse::Mailing_Address = Client::Mailing_Address]

                    SetField (Spouse::Mailing_Address;Client::Home_Address

                  End If

                End If

                • 5. Re: Look at another field
                  tmack2
                    

                  Yep! I'm not very clear.

                   

                  I have three address fields I am working with.

                   

                  The clients mailing address

                  The spouses mailing address

                  The spouses home address.

                   

                  What I want to do is to save time typing in the three fields of information.

                  So, if the spousees mailing address is the same as the clients mailing address; click a button and transfer the clients mailing address into the spouses mailing address field.

                  If the spouses mailing address is not the same as the clients mailing address but is the same as the spouses own home address and that address is different than the client's, click a button and transfer the home address into the mailing address.

                  However, if mailing address information is already in the mailing address field, check to see what info is there; Clients, home, or something different.

                  • 6. Re: Look at another field
                    philmodjunk
                      

                    It seems you have four address fields:

                    The clients mailing address

                    The clients home address

                    The spouses mailing address

                    The spouses home address.

                     

                    And that extra address is shown in your sample script.

                     

                    You might avoid the issue entirely by storing address records in a separate table. You could then list all appropriate address records in a portal with one designated as the mailing address (I think that's the purpose of your script?). Then entering info on a spouse simply requires linking to the same address records--that might make for both a simpler screen layout and a less complex script.

                     

                    Another option is to enable drag and drop in preferences. Then you can select the contents of any field; drag and drop it into another field.

                     

                    With regards to your script, it's not immediately obvious how a script can correctly select the appropriate address to copy into the Spouse::Mailing Address field. If using four such separate fields, I might choose to create separate buttons, each of which copies from a different address field. The fact that the user is choosing a source field to copy will greatly simplify your script(s). You could actually do this with one script and each button passes a script name as a parameter.

                     

                    IF [IsEmpty ( Spouse::Mailing_Address )]

                      SetField [Spouse::Mailing_Address; getField ( Get ( ScriptParameter) ) ]

                    Else 

                      Show Custom Dialog ["Clear the address or copy?"]

                      If [Get (LastMessageChoice)="1"]

                        SetField[Spouse::Mailing_Address;""]

                      Else

                         SetField [Spouse::Mailing_Address; getField ( Get ( ScriptParameter) ) ]

                      End If

                    End If

                     

                    With the button next to the Client::Home_address field, set a parameter with the expression: GetFieldName ( client::Home_Address)

                    The getfieldname function keeps your script working should you later rename the field.

                     

                    • 7. Re: Look at another field
                      tmack2
                        

                      I like the idea of a table for the address info and showing it in a portal. I normaly do so, however I am actually working with the home address and mailing address for, client, spouse, children, parent, and other family/relative members. Some address will relate to family members and some not.

                      S o what I am doing is creating seperate records for each person, relating the records by a family ID and then allowing for a quick way of copy&paste during data entry to save time.

                      Example: parents are seperated. children  are sepated by parent and or jointly shared by parent. Now with this example I have many different home and mailing addresses, Dad lives in a home but has mail sent to PO box......

                      I'm not too experienced working with portals, at least not in this area.

                       

                      Thank you for your assistance on this matter. I will not take up any more of your time.

                      Tom

                      • 8. Re: Look at another field
                        philmodjunk
                          

                        Using an intermediate Join table, you can link many address records to many individuals and you can use the Join table to list the addresses that are appropriate for a given individual.

                         

                        Portals are a very useful tool. If you aren't familiar with them, learning how to use them will greatly expand what you can set up in filemaker.