Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Duplicating layout and record

Featured Replies

I'm trying to copy a layout, call it layout A, including the records to be copied to another layout, call it layout B. I need to have all the records, fields, content, and everything in layout A to be in layout B. so layout B should be exactly the same as layout A. there are about 4000 records in layout A and i'm not familiar with scripting, what is the best way to duplicate the layouts? i could only copy the layout but none of the contents get copied over. any suggestion is much appreciated!

-pokeguy

I take it you are talking about two files? If so, just 'Save a copy as'. Otherwise just import the records from A to B.

  • Author

i want to move a layout, including its records and content, from one file to another file. so now file A and file B will have the same exact layout with records and everything the same. sorry if i was misleading. Thanks!

Hi Pokeguy, and welcome to the forum.

I think what is confusing, is your description of what you want to do. For clarification, are the two layouts going to reside in the same File (i.e. Contacts.fp5) or in different files such as Invoice.fp5 and Line Item.fp5?

Lee

  • Author

They are going to be different files. We want 2 different files that have the same layout and the same records.

Than save a copy of the one and rename it, Bingo, you have two files that are identical.

WHY?

Why what???

  • Author

no i don't want two identical files. I want two layouts including its records to exist in two separate files.

Well then you're going to need to add all the necessary field definitions to your second file, then select all objects in Layout Mode, copy, then paste into your new file, verify the fields are all the same, then import all records from your first file. Much easier to copy the file and make the changes you want.

If all of your Fields in File A already exist in File B, then all you would need to do is to copy your layout and paste it onto a layout in File B. You can do this in Layout Mode in both File A and B.

The easiest way is to create a blank layout in File B, and then Select All in File A and Copy. Go to the Layout in File B and paste.

To move the records, first isolate the ones you want in File B in File A, and then, In File B, you can import the records from File A.

If you need help with any of the steps, either come back to us, or use the Online Help in FileMaker or RTFM

Lee cool.gif

Hi JT,

It won't be hard to post back faster than me this week. laugh.gif My grandkids are here and I keep getting interrupted.

Lee

P.S., I'll leave my post however, I need the count because, you are getting too far ahead of me.

also, I got logout in the middle of all of this. wink.gif

Haha! And I wasn't even around here much yesterday. You need to push harder on days when I'm absent. wink.gif I would think that having grandchildren around would be a more rewarding experience than post-racing with a virtual personality anyway. boing.gifhairout.gifjester.gif

  • Author

thanks for all your inputs! i'll give it a try

  • Author

We have a few hundred fields now, and that we can tell we have to define each field. Is there an easier way to do this so we can copy the records into this new thing?

  • Author

aren't there scripts that "copy" all fields from one file to another? with that many fields, it'd take a long long time to sort through the list to match up with where the fields are located. is there anything besides manually added the fields one by one?

Not unless you use some sort of plug-in perhaps. It's much easier to duplicate the file and make your changes. I've had to rebuild a file from scratch before, and match up the fields as you indicated. It's a pain in the neck, but sometimes you gotta do what you gotta do.

Which goes back to one of the first suggestions made.

How about creating scripts to copy some fields from 1 record in file A, to some some fileds in record B?? I have been trying, and managed to get one funtion that works some of the time and not the rest....surely it should be possible to just hit a button and update the related file...? confused.gif

Use Set Field [relationship::fieldX, fieldY] for each field that you want to update, where relationship is a unique relationship from fileA to fileB.

thanx very much for that....i'll give it a try!

.....er is that a unique relationship for each field you want to update?

...not if you want to change fields in the same record.

e.g.

Set Field [relationship::fieldA, fieldB]

Set Field [relationship::fieldB, fieldC]

Set Field [relationship::fieldC, fieldD]

will change fieldA, B, and C on the same record in the related file.

  • 3 months later...

....several months later....Ok so I'm back with another challenge!

related to the above...

I am trying to write a script to copy certain fields from current file to cerain fields on several newly created related records....

I have so far successfully created a script to create the new records depending on a number in a field as to how many records it creates. I then want to copy the same data several times (i.e. once to each new record)in the related file, and have a number from 1 to how ever many in the related file for that particular copy operation.

the problem i am finding is that to get a working relationship for this, i seem to need to manually add in a value to a match field in the new record....at times there may be as many as 60 new records at a time...so i want even that "ID" to be automatically copied....

in case it helps....the application is for designing audio wiring for recording studios:therefor some equipment may have 60 "channels" with the same function, but a different "channel" number.

...anyway...I will keep working on it for now...and look forward to any feedback

I would have the new records auto-entered with, say, 1. Then use a relationship from the first file, which has a calculation or auto-enter of 1, to the auto-entered field in the second file. A script can set related fields and then change the auto-entered field so that it no longer matches. When the relationship is next referenced, it will be associated with a different record. Your script would look something like:

Loop

Exit Loop If [isEmpty(relationship::serial)]

Set Field [relationship::field1, data]

Set Field [relationship::field2, data]

Set Field [relationship::field3, data]

Set Field [relationship::auto-enteredfield, ""]

End Loop

...i'll give it a wurl & let you know how i get on! many thanks for the idea!

  • 4 weeks later...

....thanks very much for the above technique ....I am using it over & over at the moment.....really saving me hours of drudgery!

....by the way....do you happen to know if there is a way (in fmp 5) of using the "set field" comand on repeating fields....(i.e. set repetetion 1 etc)

I have tried the "current repetition number" function with no joy...

anyway....i have a work around if not....

thanks again for the top tips!

When you specify the target field in a Set Field step, change the Repetition box from 1 to whichever rep you want.

...oh thats what that "specify" is for....!

...well, that was a bit unchallenging for you...so here's a couple of other

repeating type things...1)is there a way to get a calc field to return a value equal to the number of reps of a rep field that have data(I've tried this one for a while but no joy...)

..2)is there a way to get a related container field to display as a repeating field, (with different contents in each rep)...so far I have had to resort to lookups instead, but this is making my file size a bit bloated!

....p.s....i tried to post a reply a few minutes ago, which i think i must have aborted by accident...but if another appears, you'll know why...

....again, many thanks for any input you are able to offer..

1. Count(repfield)

2. Is your related container a repeating field? Or are you wanting to display different related container fields in each repetition? If so, you can create a global repeating field and populate it with 1 in the first rep, 2 in the second rep, etc., and then define your calculation as Choose( globalrep - 1, rel::container1, rel::container2, ... )

...again many thanks....

you wouldn't believe the complex calcs I tried for the count(repfield) thing...

...and there it was under my nose all the time!

.....with the second question, I think your second sugestion sounds like the one, and hopefully i have understood the theory....I'll let youk know later...

...oh yes...which table would the global field be in...the related file i presume (where the graphics are located)..?

The global would be in the current file, where the calculation is performed.

...i've not quite got it...

just to clarify: currently i have a graphics file, with little more than a container field and a match field, & about 20 records with different graphics.

Then in the main file, I have a repeating container field that currently looks up the graphic (repeating horizontally accross the page) & under that a repeating match field with a drop down value list from the match field of the graphics file ...

....so what i dont quite get, is how & where i would layuout the global field,

and where would the calculation go...& where would the related graphic end up displaying?....

....also, i need to display different combinations of the graphics(accross the repetitions)in each record....

....I hope that paints a clearer picture of what i am trying to achieve...& hopefully what you are suggesting will work....

....manrwhile I will continue to try to get my head round what you've already explained....and many thanks again.....

So, your graphics file contains 20 records with a different graphic in each record and only one container field? I thought you meant you had a container field for each graphic, which would make it easier.

It might help if you posted the two relevant files, so we don't have to guess what each other is talking about. wink.gif

....thats a good idea. I will post just the 2 files in question & hopefully the lack of other related files wont cause it to missbehave!

.....maenwhile I will try making the graphics file repeating containers instead of seperate records...

...again many thanks

VortexPatchHoles.zip

...ok so now I have successfully loaded the files, heres a quick explanation:

go to a layout in PB designer such as 48 holes row or 24 holes row...if you click on the thin purple repeating field just below the "hole" field, you will soon see what I am trying to achieve: just to recap. it works fine except the fact that its using lookups & therefore adding unneccessary file size...

...hope that all makes some sense.....

Sorry, but only one of your files, Vortex Patch Holes, made it into the zip. Try zipping your files again, editing your previous message, and posting the new zip in place of the original one.

You can only post one attachment at a time. It is easier if you zip both files together and then post a single zip.

After reviewing the file, I don't think there will be an easier way to do this. I thought that using a single repeating container field and a GetRepetition calculation might work, but then I remembered that GetRepetition has a bug in version 5 which can be worked around for other types of fields, but not containers.

So, unless someone else has a better idea, I would say the way you are doing it now is the best that can be done until you upgrade to version 7.

...well thanks very much for taking the time to look it over...I really appreciate how helpful you have been...

....oh,,,but would this work:

...in PB designer, I add new matchfields (I'll need lots though...is there a limit??)& for each new match field a new relationship(are there limits there too?) and then instead of repeating container fields, I insert the related field on the layout multiple times....each time "via" a different relationship....I'm sure it will work except for the stupid amounts of fields & relationships...& I wonder even if it does work, if it is good practice to use that many(i.e. does it cause problems....etc)

....perhaps i will wait for some feedback before i lunge to far ahead...

...of course i am presuming that you cant build relationships based on a particular repetition of a repeating field...(i have looked & cant see any way of doing that)

....amny thanks again....

Yes, you can do that, and I highly doubt you'll ever approach a limit to the number of relationships or fields. I never have and I've used over 300 fields for a single report before. wink.gif

I wonder, though, if it's really worth it to go to all that trouble rather than to purchase a larger hard drive that would make the file size a non-issue. It would probably cost you more to overhaul your design than to buy a new one. Just a thought. Ask.gif

no i don't want two identical files. I want two layouts including its records to exist in two separate files.
Why?

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.