• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 465
  • Last Modified:

Separating a field of un-predictable comma-separated values into individual records and repeating remaining field values in each record for each of the new, separated records?

I have a Filemaker dB table named "Property".  Each record in the table describes an individual owner's property as such:

- Township (Twp)
- Range (Rng)
- Section (Sec)
- Legal Description (Legal)

Twp, Rng and Sec fields all have single, non-comma delimited values per record, but the Legal field contains multiple, comma-separated values, as follows:

Record1      Twp1      Rng1      Sec1      Legal1, Legal2, Legal3
Record2      Twp2      Rng2      Sec2      Legal4, Legal5, Legal6
and so on...

Ultimately I want to have an end-product w/ the values in the Legal field in their own individual record while duplicating the Twp, Rng & Sec fields for the original record into the new records, i.e.

Record1      Twp1      Rng1      Sec1      Legal1
Record1      Twp1      Rng1      Sec1      Legal2
Record1      Twp1      Rng1      Sec1      Legal3
Record1      Twp2      Rng2      Sec2      Legal4
Record1      Twp2      Rng2      Sec2      Legal5
Record1      Twp2      Rng2      Sec2      Legal6

I am unsure of how to do this w/in FM11 solely and directly and I am even willing to export into Excel, manipulate the data and then import into a new table in FM11, if necessary.

This will not be a repetitive task, as this is simply cleanup on a legacy dB that I inherited from a previous employee and therefore accuracy is my primary focus, not repetition.

Thank You in Advance for any and all help you can offer!!!
0
johnsodolak
Asked:
johnsodolak
  • 4
  • 2
  • 2
  • +1
1 Solution
 
jppintoCommented:
Did you tryed Data-Text to Column feature?
0
 
johnsodolakAuthor Commented:
No, I have not...can you elaborate?
0
 
jppintoCommented:
This will separate the fields in each row into each column.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
johnsodolakAuthor Commented:
JPPINTO...I just viewed a quick article on "Data-Text to Column" feature in Excel.  How would I go about moving that "separated" text in each of the new columns back into the original column, create a new row, and duplicate/fill-down the data from the remaining columns in the original row?

Thank You for your response!
0
 
challengedayCommented:
Interesting question!

You could do it with a script in FM.

(If the Legal values were in related records then exporting would get you half way there - the same place as the Data-Text to Column)

Going the route you are currently going... maybe this Columnizer software may help:
http://www.aplusfreeware.com/misc/Columnizer/Columnizer.html
0
 
Will LovingPresidentCommented:
In order to move this data from your current structure to the structure you describe with multiple records and each "Legal" value you need to do an import from the old structure in a way that isolates each of the comma-separated legal values. Here's how I would do this: Create a calculation field the will determine the N number value in the Legal field:

LegalCalc = GetValue( Substitute( Legal ; "," ; "¶" ) ; 1 )

This calculation will give you the first value in the legal field. It uses the Substitute () function to convert all commas to Carriage returns giving you a return-separated list of all the values in "Legal". The GetValue() function then determines which value get's used, in this case it's value "1". I might take this calculation a little further by adding a Trim() function to it to cleanup and leading or trailing spaces that might be left over after converting the commas, so:

LegalCalc = Trim( GetValue( Substitute( Legal ; "," ; "¶" ) ; 1 ) )

You are now going to do a series of imports from your old table into your new one. The first import is going to simply be all records. You will import the LegalCalc field into the Legal field in the new table. Then, go back, change the 1 to a 2 and do a find in the old table for all records that now have a value in LegalCalc. This will be all records that have a second value in the old Legal field. Import those records into the new table.

Now, go back change the value in the calc from 2 to 3 and perform a find again in the old records which will result in all records that have a third value and import those records. Rinse and Repeat until you have performed as many imports as the maximum number of values that the Legal field might hold. YOu'll know because when you put in a number and perform the Find, no records will be found.

You will now have a set of records for each Property, each one having a unique Legal value.
0
 
challengedayCommented:
I was thinking about this and just came up with the same multi export (or multi import) scheme, came back and there's your answer willmcn (that's why you're master level!)

I was going to suggest the MiddleWords Text function which will just grab the right value without having to substitute.

With MiddleWords on the string "one, two, three, four"
MiddleWords ( field; 2; 1) gives "two"
0
 
Will LovingPresidentCommented:
If the comma is a reliable separator in the Legal field and there is any possibility that the value in legal might be more than one word, then using the GetValue and Substitute functions are a cleaner way to go. Using Middlewords() does eliminate the need for the Trim() that I suggested and ignores the comma, but can't deal with multiple words between commas.
0
 
johnsodolakAuthor Commented:
Thanks for the great responses!  I am going to test all of these out and hopefully be grading tomorrow...
0
 
johnsodolakAuthor Commented:
I cannot apologize enough for taking so long to apply these points.  Thank you so much for your response and I still cannot apologize for the tardiness.

The solution was ideal for my situation!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now