|
Your continued generosity and support of FMForums is greatly appreciated. |
Plucky
enthusiast
Posts: 30
Post Rank (AVG):
FMP: 9 Advanced OS: Mac OS X Tiger Skill: Intermediate
Tweet This Post!
|
Hi
I have multiple portals on a layout and would like to have a
script that can copy all the rows from one portal to another.
Portal_1 is a Estimate portal.
Portal_2 is the one used for costing.
I have other portals on the layout which do not need changing.
There can be several rows in the Estimate Portal_1 so I need it to copy all rows and add these to Portal_2
any ideas.
|
|
|
efen
master
Posts: 334
Loc: England
Post Rank (AVG):
FMP: 8.5 OS: Windows XP
Tweet This Post!
|
In response to Plucky
There are a couple of files in this post
http://fmforums.com/forum/showtopic.php?tid/211044/post/340267/fromactivity...
that can be adapted to move all portal entries to another portal (they presently only move one row at a time)
|
Plucky
enthusiast
Posts: 30
Post Rank (AVG):
FMP: 9 Advanced OS: Mac OS X Tiger Skill: Intermediate
Tweet This Post!
|
In response to efen
Hi efen
I have it copying over individual records but cannot get it to loop all the records in the portal.
|
efen
master
Posts: 334
Loc: England
Post Rank (AVG):
FMP: 8.5 OS: Windows XP
Tweet This Post!
|
In response to Plucky
See if the attached helps
|
Plucky
enthusiast
Posts: 30
Post Rank (AVG):
FMP: 9 Advanced OS: Mac OS X Tiger Skill: Intermediate
Tweet This Post!
|
In response to efen
Hi efen
I have tried your example and it seems to keep looping on it self.
Can you try the attached example to see what i'm trying to do.
I understand the copying into variables it's just the looping bit and how it knows when to stop.
|
efen
master
Posts: 334
Loc: England
Post Rank (AVG):
FMP: 8.5 OS: Windows XP
Tweet This Post!
|
In response to Plucky
It is a never-ending loop in your file because you haven't specified when it is to stop - the Exit Loop If step is missing the "stop" - the number of rows in the portal.
You need an extra field (in my example file it is called "total")in your Orders table - an unstored calc field showing the number of related records in the portal you are transferring from (EstimateLine)
Define this total field as Count(EstimateLine::EstimateID)
Add the "stop" condition to the Exit Loop If as $counter=EstimateLine::total+1
|
efen
master
Posts: 334
Loc: England
Post Rank (AVG):
FMP: 8.5 OS: Windows XP
Tweet This Post!
|
In response to efen
Uh-oh
Just did this in your file, assuming it was set up like mine, but it doesn't work. Your relationships are different and you have allow creation/deletion of related records. I don't have time to look at/change this at the moment...
The "stop" should be
Exit Loop If $counter= total field +1
This works when there is more than one portal row. You need to add/amend the script to accommodate these.
Edited by efen on 10-22-09 11:23 AM. Reason for edit: change calc + text
|
lastpass
novice
Posts: 23

Post Rank (AVG):
FMP: 10 Advanced OS: Windows Vista Skill: Entry Level
Tweet This Post!
|
In response to efen
Hi!
I have almost the same problem like Plucky had and I try efen advice but that didn't work. I set up the exit loop with 'Max ( EstimateLine::EstimateID )'.
It seems working but if I delete a portal row it can be made mistakes? Like if rows empty the loop will never ending... . And if you push copy button again the portal rows will duplicated.
Wich is the best solution for these problems? And how can I copy just the marked ones? (chekbox in the 'ordered' field).
Thank you in advance!
Edited by lastpass on 01-17-10 03:54 PM. Reason for edit: No reason given.
|
BruceR
Pooh-Bah
Posts: 2031
Loc: Redmond WA
Post Rank (AVG):
FMP: 10 Advanced OS: Mac OS X Leopard
Member: TechNet
Certified:
DBUG SIG
Tweet This Post!
|
In response to lastpass
Try this. Uses auto-create relation and Resource table w/global fields.
|
RodSierra
apprentice
Posts: 135
Post Rank (AVG):
FMP: 10 Advanced OS: Cross Platform
Tweet This Post!
|
In response to BruceR
Am I missing something here or can this be done much more simply by establishing a found set for the source of an import by using GTRR, then importing that found set in the destination table.
Other point if I need to loop thru a portal with a create option set, I test to exit the loop by checking if the key field to the relationship is empty, this will find the last portal row every time.
Don't want to derail the current discussion, sorry if I did.
|
lastpass
novice
Posts: 23

Post Rank (AVG):
FMP: 10 Advanced OS: Windows Vista Skill: Entry Level
Tweet This Post!
|
In response to RodSierra
Thanks the answers and the file. I thought FM will be easier like it described in the homepage: "Award-winning, easy-to-use database software..." I don't understand your method (yet) but thank you very much!
I completed script with an 'If' and 'Set field' orders and I created a 'lock field' at 'orders' layout. These make it possible to pressing the button just one time. Next time will exit from script.
(attached if anyone needs and sorry for my language mistakes )
|
BruceR
Pooh-Bah
Posts: 2031
Loc: Redmond WA
Post Rank (AVG):
FMP: 10 Advanced OS: Mac OS X Leopard
Member: TechNet
Certified:
DBUG SIG
Tweet This Post!
|
In response to RodSierra
Am I missing something here or can this be done much more simply by establishing a found set for the source of an import by using GTRR, then importing that found set in the destination table.
Other point if I need to loop thru a portal with a create option set, I test to exit the loop by checking if the key field to the relationship is empty, this will find the last portal row every time.
Don't want to derail the current discussion, sorry if I did.
I never walk portals. And I hardly ever go to any other layout to create records - needless flashing. I consider walking portals a very bad and vulnerable idea. By using the technique illustrated in my example you have a way to select and operate on records for other purposes. By putting the globals in the Resource table the basic data tables remain uncluttered of additional global fields.
Yes, the import option would be valid also. The looping set field script allows you to have some control over what happens to each field if that is important.
|
lastpass
novice
Posts: 23

Post Rank (AVG):
FMP: 10 Advanced OS: Windows Vista Skill: Entry Level
Tweet This Post!
|
In response to BruceR
I try to modify the example file to my own imagination but I met with some heavy difficulties and I can't figured out how can I make this:
I want to use second portal (polymer) to an other layout. And I want to polymer portal contained the estimate record ID and the new Polymer record ID.
I want to create an order database based on outgoing quotation. But some orders come directly from my partners without outgoing quotation. So I need to copy portal rows from quotations to orders and make orders independently.
Can you help me?
|
lastpass
novice
Posts: 23

Post Rank (AVG):
FMP: 10 Advanced OS: Windows Vista Skill: Entry Level
Tweet This Post!
|
In response to lastpass
I tried many ways to copy portal rows into an other wich is in a different layer but I can not figured out how will it work. I attached a sample (based on previus files, FM10) wich has a problem: the portal rows displayed in an other record. If anyone could help me I will appreciate.
|
merkaba22
master
Posts: 342
Loc: Hollywood, CA
Post Rank (AVG):
FMP: 10 OS: Mac OS X Snow Leopard Skill: Advance
Tweet This Post!
|
In response to lastpass
The example is not downloading -- is there a way to repost?
"We are the ones we have been waiting for!”
"We owe a lot to the Indians (from India), who taught us how to count, without which no worthwhile scientific discovery could have been made." - Albert Einstein.
Twenty years from now you will be more disappointed by the things you didn't do than by the ones you did do ... Explore. Dream. Discover'. Mark Twain
"Someday," Neil Young said, "the digital age will be seen as the Dark Ages of recorded sound."
"Like the Maya, we shall understand that the path to the stars is through the senses."
"Dream big -- because no matter how big that is, it's nothing compared to what you really can do".
"Using the most reliable approach for bending reality to your desires, imagination is always the key first ingredient, then by adding clear intention, expectation and action, results will be realized."
|
|
merkaba22
master
Posts: 342
Loc: Hollywood, CA
Post Rank (AVG):
FMP: 10 OS: Mac OS X Snow Leopard Skill: Advance
Tweet This Post!
|
In response to lastpass
deleted by user
"We are the ones we have been waiting for!”
"We owe a lot to the Indians (from India), who taught us how to count, without which no worthwhile scientific discovery could have been made." - Albert Einstein.
Twenty years from now you will be more disappointed by the things you didn't do than by the ones you did do ... Explore. Dream. Discover'. Mark Twain
"Someday," Neil Young said, "the digital age will be seen as the Dark Ages of recorded sound."
"Like the Maya, we shall understand that the path to the stars is through the senses."
"Dream big -- because no matter how big that is, it's nothing compared to what you really can do".
"Using the most reliable approach for bending reality to your desires, imagination is always the key first ingredient, then by adding clear intention, expectation and action, results will be realized."
|
Edited by merkaba22 on 03-02-10 11:59 AM. Reason for edit: No reason given.
|
|
Your continued generosity and support of FMForums is greatly appreciated. |
merkaba22
master
Posts: 342
Loc: Hollywood, CA
Post Rank (AVG):
FMP: 10 OS: Mac OS X Snow Leopard Skill: Advance
Tweet This Post!
|
In response to merkaba22
moved to another area
"We are the ones we have been waiting for!”
"We owe a lot to the Indians (from India), who taught us how to count, without which no worthwhile scientific discovery could have been made." - Albert Einstein.
Twenty years from now you will be more disappointed by the things you didn't do than by the ones you did do ... Explore. Dream. Discover'. Mark Twain
"Someday," Neil Young said, "the digital age will be seen as the Dark Ages of recorded sound."
"Like the Maya, we shall understand that the path to the stars is through the senses."
"Dream big -- because no matter how big that is, it's nothing compared to what you really can do".
"Using the most reliable approach for bending reality to your desires, imagination is always the key first ingredient, then by adding clear intention, expectation and action, results will be realized."
|
Edited by merkaba22 on 03-02-10 11:58 AM. Reason for edit: No reason given.
|
|
|