Solved

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?

Posted on 2011-02-10
10
421 Views
Last Modified: 2012-05-11
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
Comment
Question by:johnsodolak
  • 4
  • 2
  • 2
  • +1
10 Comments
 
LVL 33

Expert Comment

by:jppinto
ID: 34866931
Did you tryed Data-Text to Column feature?
0
 

Author Comment

by:johnsodolak
ID: 34866964
No, I have not...can you elaborate?
0
 
LVL 33

Expert Comment

by:jppinto
ID: 34866987
This will separate the fields in each row into each column.
0
 

Author Comment

by:johnsodolak
ID: 34866990
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
 
LVL 4

Expert Comment

by:challengeday
ID: 34867294
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 24

Expert Comment

by:Will Loving
ID: 34867336
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
 
LVL 4

Expert Comment

by:challengeday
ID: 34867388
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
 
LVL 24

Accepted Solution

by:
Will Loving earned 500 total points
ID: 34867427
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
 

Author Comment

by:johnsodolak
ID: 34867931
Thanks for the great responses!  I am going to test all of these out and hopefully be grading tomorrow...
0
 

Author Closing Comment

by:johnsodolak
ID: 34984437
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now