mandyang Posted August 27, 2002 Posted August 27, 2002 Hi, I've 5 fields(repeating fields,column) in my db. The problem I've is I can't copy all the fields at one go.(I want to copy the whole row at one go) Currenty I need to go to every fields to copy one by one to another file. I've written script to copy but the script only works for the first record.
Pontus Posted August 27, 2002 Posted August 27, 2002 Repeating? You mean that those fields should keep the same data through the comple database? Well you can set auto-enter from Previous record or special data, just using the Options choice in the Define Fields dialog.
mandyang Posted August 28, 2002 Author Posted August 28, 2002 Thanks for your reply. But what I want is: Item(field) Description(field) Price(field) (R1) 1 Candy 3.00 (R2) 2 Chocolate 5.00 I want to select the whole of row one(R1) to another FM aplication.
CobaltSky Posted August 28, 2002 Posted August 28, 2002 It's a bit tedious, but it can be done. To copy a whole row to a corresponding destination row, you'll need a script which transfers each value in turn. To do this, first create a global text field called "gTemp.txt" (assuming your repeating fields are text fields). Then create a script along the lines of: Set Field ["gTemp.txt", "GetRepetition(ItemField, 2)"] Set Field ["YourRelatedDb::RelatedItem"-2, "gTemp.txt"] Set Field ["gTemp.txt", "GetRepetition(DescriptionField, 2)"] Set Field ["YourRelatedDb::RelatedDescription"-2, "gTemp.txt"] Set Field ["gTemp.txt", "GetRepetition(PriceField, 2)"] Set Field ["YourRelatedDb::RelatedPrice"-2, "gTemp.txt"] Set Field ["gTemp.txt", ""] There's no escaping the fact that you'll need a number of scripts along the lines of the above, so it isn't a highly flexible solution, but it may be better than the manual alternative. A much better and more flexible approach would be to dispense with the repeating fields and use portals listing related records from a sub-file instead.
CobaltSky Posted August 28, 2002 Posted August 28, 2002 Further to my previous post, the inimitable 'Dj' has (on a thread elsewhere) suggested a more streamlined 'work-around' for the problem, and I thought it might be useful to you if I posted it here. (incidentally, the 'reason' for the difficulty which led me to suggest a two-step copy procedure for each value is discussed on the FMI knowledge Bnase article no 104269 if anyone is interested in the background) The more streamlined 'fix' is to include & "" after the GetRepetition function. Don't ask me why, but I tested it and it seems to work. Thus the seven steps of the script I suggested in the previous post could be compacted down to: Set Field ["YourRelatedDb::RelatedItem"-2", "GetRepetition(ItemField, 2) & "" "] Set Field ["YourRelatedDb::RelatedItem"-2, "GetRepetition(DescriptionField, 2) & "" "] Set Field ["YourRelatedDb::RelatedDescription"-2, "GetRepetition(PriceField, 2) & "" "] Which I'd have to say is tidier than the foregoing option (not to mention the fact that no global field is required...).
Recommended Posts
This topic is 8223 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 accountSign in
Already have an account? Sign in here.
Sign In Now