petal Posted May 6, 2005 Posted May 6, 2005 i have a problem that is probably very simple to solve. i am copying data from one portal (in one layout) to another portal (same table - different layout). i am using a looping script which copies from 'portal row 1' and pastes to other 'portal row 1' and then moves onto portal row 2 and so on. the way i move to each consecutive portal row is through a calculation and a counter which increases by 1 at the end of each loop step. i cannot however get the loop to end or exit after the last portal row (i cannot use <<next, exit after last>> since this always takes me back to the first portal row when i change layouts. please be so kind as to help out.
BrentHedden Posted May 6, 2005 Posted May 6, 2005 Sometimes the hardest part of programming is getting seemingly simple things like this to actually work. It seems it should work if you increase the counter at the right time. Try something like this - Start counter at 1. Goto portal 1, goto row [counter], copy, goto portal 2, goto row [counter], paste, go back to portal 1, goto row [counter], goto row <next, exit after last>, THEN increase counter. And so on..... Bear in mind that I'm not trying this therory out because I'm not in FileMaker right now. But, it seems logical enough to me.
petal Posted May 6, 2005 Author Posted May 6, 2005 i have made some progress. the loop is set to exit if the (counter +1) is greater than the (foundcount) of the related set (which must equal the number of entries in the portal set. the only problem now is that the foundcount has never worked properly on my system (it always returns a seemingly arbitrary figure or, if set to global, returns the total record count! is this a bug? or am i doing something wrong? and, finally, is there a more elegant way to exit the script?
petal Posted May 6, 2005 Author Posted May 6, 2005 sorry brent, i posted my update as your response came in. i will give that sequence a try, but what of my foundcount problem? it has always driven me crazy.
petal Posted May 6, 2005 Author Posted May 6, 2005 thank you worked like a charm! now if someone could explain my foundcount problem
BrentHedden Posted May 6, 2005 Posted May 6, 2005 I'm glad to hear that my solution worked for you. Please remember me when I'm running for President. Is the portal set to show all records of whatever table you're displaying? If so, you could use the Get(TotalRecordCount) in your calc. This get function returns the total number of records in the table it's built in, so you would have to have a calculated field in THAT table. Using the Get (foundcount) returns the number of records in the current found set of the window that's active. I don't know how that would be useful for what you are doing, since you're not performing any finds.
Søren Dyhr Posted May 14, 2005 Posted May 14, 2005 Please remember me when I'm running for President I might have considered it, if it wern't a rotten advise you gave. Copying and pasting is by an large a bad habit - Set Field is not playing tricks with the operating systems clipboard, something important might be stored there. But but slinging the same data to two diferent places is bound to cause a syncronization issue that relationships are supposed to take care of. Nobody should really copy real data from table to another table, but instead make manipulations with the keys in the relationships. An associated FSA'er should know this, and not keep the cards close to his body ...on this 60'ies anniversary for the N
petal Posted May 14, 2005 Author Posted May 14, 2005 hiya brent a few days on and i think you should know that your recommendation works beautifully and seems very stable and reliable. i do agree that cutting and pasting seems inelegeant though. essentially, what we have achieved is to take quote line items and created invoice line items. the reason for using portals to do this is as follows: both portal are in the invoice file. the first portal linked to quote line items shows the only the approved items on the quote (a client may not approve every item on a particular quote). the second portal allows the creation of records in the linked invoice line items. by pasting a unique serial number from the quote line items into the invoice line item portal, i create a unique invoice line item. this line item then "looks up" the balance of the information from the quote line item. i can then change this data as required on the invoice without changing the original quote information. the invoice line item remains unique even if i refer to the quote line item in another invoice since the second portal is linked (partly) through the unique invoice number. therefore, if i call up the quote line item again, it creates another invoice line item. the net effect, is that i am duplicating a quote line item into an invoice line item file and linking it to a unique invoice number. the question begs whether their is a more elegant way of doing it?
Søren Dyhr Posted May 15, 2005 Posted May 15, 2005 We had almost the same topic up in this thread: http://www.fmforums.com/threads/showflat...true#Post159333 Investigate the latest template! --sd
MoonShadow Posted May 15, 2005 Posted May 15, 2005 " I might have considered it, if it wern't a rotten advise you gave." A bit strong, Soren. Brent didn't recommend copy/paste. He addressed petal's problem as was asked and focused on the counter issue. True it might be nice to also explain the problems copy/paste can cause but we don't always have the time to provide disclaimers about every possible problem which may arise in any given situation. Now apologize to Brent like a good boy.
Søren Dyhr Posted May 15, 2005 Posted May 15, 2005 Sorry - the tone might have been a bit rough, but the issue I try to raise here is this: Americans generally see the world divided between good and evil, between friends and enemies, while Europeans see a more complex picture. When confronting real or potential adversaries, Americans generally favor policies of coercion rather than persuasion, emphasizing punitive sanctions over inducements to better behavior, the stick over the carrot. Americans tend to seek finality in international affairs: They want problems solved, threats eliminated. Taken from: http://www.policyreview.org/JUN02/kagan_print.html I see the provision of disclaimers as a persuasion as such not warmongin ...I've raised this issue several times here often using Napoleon Bonapartes categorization "...a nation of shopkeepers" as a hint why we are less inclined to tolerate: Hobbes' leviathan state is infinitely authoritative in matters pertaining to aggression, one man waging war on another, or any matters pertaining to the cohesiveness of the state. It can say nothing about what any man does otherwise
BrentHedden Posted May 16, 2005 Posted May 16, 2005 Nay - I'm not worried or have any kind of hurt feelings over such a thing. Just to defend myself - I'm not the one who came up with the idea to copy/paste. I pointed out a execution timing problem. There usually is at least two different ways to perform any task. Mr. Dyhr has brought up a good point. While the copy/paste does work, there are other ways of performing the task.
Søren Dyhr Posted May 18, 2005 Posted May 18, 2005 So the reasoning in mental institutions is purely for the protection of society, and certainly not a measure to prevent the inmates harming themself??? --sd
Lee Smith Posted May 18, 2005 Posted May 18, 2005 Soren, What the heck does this have to do with FileMaker? Please limit your responses to FileMaker Q & A. TIA Lee
ronbob Posted July 2, 2005 Posted July 2, 2005 i need help... i have a portal with with two fields 1. lookup customers and 2. quantities. i need to write a script which will enter a value into quantity but looping through the list of customers. any idea
ronbob Posted July 2, 2005 Posted July 2, 2005 i will try to clarify. customer 1 has to be selected in the lookup fiels and after the value in the second field is entered a new line comes up in the portal and custormer 2 will be selected ... the same with all customers. thanks
petal Posted February 1, 2007 Author Posted February 1, 2007 hey guys i only asked a simple question – i did not know it would cause such a furore. i am big enough to make my own decisions about cutting and pasting and in any case i have replaced this with the use of variables. thanks again to those that helped. petal
Recommended Posts
This topic is 6505 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