Jump to content

Repeating fields into lineitems


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

Recommended Posts

I am fixing up an old system in which the original author (I think was a gang of drunk monkeys) used repeating fields for almost everything (and made an insane number of other design faux pas.)

I'm thinking of making some of them into the standard line items in a related database. But if i do that, I'm not sure if I can import all the old data. Is there a way?

Link to comment
Share on other sites

Ya. Thats what i was thinking but Im assuming it is easier said then done...

For example, one DB would be your run of the mill invoice with line items. In the new database i'd need one new record for each it in a repeating field AND have the invoiceID in the new records, as well as other invoice data.

I havn't even tried doing it yet, but i'm assuming its a big scripting deal or really simple import/export.

How you personally done it like that?

Link to comment
Share on other sites

Eric,

Yeah. You would think it would be hard to script, but it really is that simple.

Just set your import to import the repeating fields into their new respective fields, and the invoice id to the invoice id.

Choose seperate fields for repeating fields, and hopefully (crossing my fingers here!) your data will be seperated out and have the invoice id for each line.

Best thing, try it with a sample of data first, just a few records and check the results.

Let me know how you get on

Link to comment
Share on other sites

Careful, it depends how drunk the monkeys were!

When the "Split" box is checked, new RECORDS are created for EACH repetition. If one repeating field in a single record has 25 repetitions, you will create a 50,000 record DB from a 2,000 record one. Similarly if there is one global field with many repetitions.

Most repetitions in most of the 50,000 records will be empty unless the various repeating fields were closely coupled. Some repeating fields may have been used within records for storing parameter sets: you may not want those split up.

I would suggest: 1) keep everything intact as you import into the new DB; 2) figure out which fields to keep intact as repeating; 3) write a simple script to strip the others into line items.

Link to comment
Share on other sites

quote:

Originally posted by Wasatch:

When the "Split" box is checked, new RECORDS are created for EACH repetition.

Wrong!

I just checked, because I was pretty sure about this, and I'm right. A new record will only be created for each repetition that contains data.

It even works if you skip a repetition. In other words, if you have data in repetition 1 and repetition 3, but repetition 2 is blank, it'll create two records when you import -- for reps 1 & 3.

Link to comment
Share on other sites

Whoops, you are right.

I had figured that only those repeats with data are split, and my "25 repetitions" was meant to imply "25 data entries". Poor choice of words.

However, one of my repeat fields happened to be a global, and that does give rise to a copy for each record. I agree that regular fields behave much better.

Wasatch

Link to comment
Share on other sites

This topic is 8069 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.