6 Replies Latest reply on Oct 12, 2009 1:28 PM by GaryCowley

    Rolodex operation with parse

    GaryCowley

      Title

      Rolodex operation with parse

      Post

      I am using a script from a contact-management--The Get(ScriptParameter) is the Letter of the Rolodex button.

       set error capture (on)

      Enter find Mode

      Set field [Contacts::k_Contacts_search;Get(ScriptParameter)]

      Perform Find

      If [Get(LastError = 401]

      Show Custom Dialog ["No Customers Found"; " No customers with the name starting with "& Quote(Get(ScriptParameter)) & was found. "]

      Show all records

      End If

       

      This works but finds any use of that letter in the company name--

      I want to look at the first letter only.

      I have tried to add after the --------- Set field [Contacts::k_Contacts_search;Get(ScriptParameter)]

      the following -----------Set field [Contacts::k_Contacts_search;LeftWords(Contacts::k_Contacts_search; 1)]  

       

      I have used filemaker for many years but have a limited knowledge of syntax or calcs.

        • 1. Re: Rolodex operation with parse
          philmodjunk
            

          Try

           

          Set field [Contacts::k_Contacts_search;Get(ScriptParameter) & "*" ]

           

          and see if that does what you want.

           

          This assumes that Get(ScriptParameter) is always returning a single letter of the alphabet.

          • 2. Re: Rolodex operation with parse
            GaryCowley
              

            PhilModJunk,

             

            I tried your fix and I get the same response.

            I am using 10 advanced and looked at the data viewer and the script debugger.

            I see that my K_contacts_search shows the full value (All Saints Episcopal)

            Then I get the single letter with the asterisk  (E*) and then my find value is the whole field.

             

            This is a printing company data base for churches---They all have a combination of the same words--st.--church---etc.

            I am giving them a search-name field that they can copy part of the customers name into and then search.

             

            Any other hints?

             

            • 3. Re: Rolodex operation with parse
              mrvodka
                

              Create a calc of: Left ( Contacts::k_Contacts_search ); 1 )

               

              Enter find Mode []

              Set Field [ cFirstLetter; Get ( ScriptParameter ) ]

              Perform Find []


               

               

              • 4. Re: Rolodex operation with parse
                GaryCowley
                  

                Mr_vodka,

                 

                Sorry for my lack of experence.

                I have used filemaker for many years but have a limited knowledge of syntax or calcs.

                I am getting no syntax error-- FirstLetter; 

                 

                 Set Field[Contacts::k_Contacts_search; Left (Contacts::k_Contacts_search ; 1 )]

                 Set Field[Contacts::k_Contacts_search; FirstLetter; Get (ScriptParameter)]

                 

                I must have a missunderstanding of how to put your solution into my script.

                 

                 

                • 5. Re: Rolodex operation with parse
                  mrvodka
                    

                  Create a new calculation field. Lets call it cFirstLetter which has a formula of: Left ( Contacts::k_Contacts_search ); 1 )

                   

                  Now your script will do the search in the new calc field.

                   

                  Enter find Mode []

                  Set Field [ cFirstLetter; Get ( ScriptParameter ) ]

                  Perform Find []

                   

                  • 6. Re: Rolodex operation with parse
                    GaryCowley
                      

                    Thanks,

                     

                    The minute you said   Make a New Calc field, the light went off and I understood.