Jump to content
Server Maintenance This Week. ×

Exporting by "State" column to Seperate CSVs


This topic is 3605 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

Hi, I'm new to the boards and to Filemaker Pro, so please bear with me:

 

I have a giant list of contacts that is 180,000 rows, with columns such as name, address, company, state. The contacts are from all 50 states. I want to break down the giant list into 50 seperate lists, by U.S. state.

 

Right now I'm just doing a CTL+F under the "State" column and typing "CA" for example, then exporting the list of California contacts to CSV. It works, but is very time consuming.

 

Is there a way to make this faster? Maybe a script or macro I can create? I will be doing this every week, so trying to find an easier, more efficient solution.

 

Thanks and please let me know if I need to clarify anything!

 

--Andy

Link to comment
Share on other sites

For example:

Set Variable [ $states; Value:ValueListItems ( Get ( FileName ) ; "States" ) ]
Loop
    Set Variable [ $i; Value:$i + 1 ]
    Exit Loop If [ $i > ValueCount ( $states ) ]
    Enter Find Mode [  ]
    Set Field [ YourTable::State; GetValue ( $states ; $i ) ]
    Perform Find [  ]
    Set Variable [ $filename; Value:GetValue ( $states ; $i ) & ".csv" ]
    Export Records [ File Name: “$filename” ]
End Loop
Link to comment
Share on other sites

  • Newbies

I was just about to suggest the exact same approach, but it's hard to be faster than comment …  :laugh:

 

See here for a sample file with a script that uses this method.

 

Ok, so I realized I have FM Pro Adv version 9... :idot:

Link to comment
Share on other sites

This topic is 3605 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.