3 Replies Latest reply on Jun 6, 2011 12:47 PM by philmodjunk

    Extracting address from one field into many fields

    vet_guy

      Title

      Extracting address from one field into many fields

      Post

      I've received a CSV file which has address info in one field and is in the format of:

      Street <CR>

      City <CR>

      State <CR>

      Zip

      I need to extract each line and place them into appropriate fields.

      Any easy way to do this?

      Thanks

        • 1. Re: Extracting address from one field into many fields
          LaRetta_1

          Yes, import the address into the single field (for this example let's call it AddressString).  Then to split to fields, create your fields (be sure the zip field is text and not number) and then script would be (back up your file first):

          Go To Record/Request/Page [ first ]
          Loop
          Set Field [ Street ; GetValue ( AddressString; 1 ) ]
          Set Field [ City ; GetValue ( AddressString ; 2 ) ]
          Set Field [ State ; GetValue ( AddressString ; 3 ) ]
          Set Field [ Zip ; GetValue ( AddressString ; 4 ) ]
          Go To Record/Request/Page [ Next ; exit after last ]
          End Loop

          Once you have verified that it all worked properly, you can delete the AddressString.  Another approach, if you might be concerned about the data at all, is to create calculations out of each of these new fields using the GetValue() calculations provided.  Then you can view the data to be sure it all works.  Once you know it is okay, just change the fields from calculations to standard text fields.  Since the calculations are stored, the data will plant into the fields when you change them and then exit field definitions.

          • 2. Re: Extracting address from one field into many fields
            vet_guy

            That worked great.

            Where can I find a list of functions with their description?

            • 3. Re: Extracting address from one field into many fields
              philmodjunk

              Look up functions in filemaker help.