In FMP scripts (methods) are attached to files (tables), so it’s irrelevant what layout (form) you’re currently on when running a script. But this doesn’t appear to be the case in Servoy and SQL.
Is there an easy way to transfer the same found set from one form to another? For instance, I currently have a set of three records in FormA. FormB (same table) has a method that does exactly what I need to do right now in FormA. I can easily call that method from within the current method, come back and carry on.
I’m discovering the Found Set currently attached to FormB may not necessarily be the same three records. Just calling the FormB method I’m interested in may process the wrong records. Am I correct in this apprehension?
I’m reaching for a function I can’t quite articulate but sense is probably available. Am I making myself clear?
Morley:
In FMP scripts (methods) are attached to files (tables), so it’s irrelevant what layout (form) you’re currently on when running a script. But this doesn’t appear to be the case in Servoy and SQL.
Correct you can access form elements so table based script idea will not work
Morley:
Is there an easy way to transfer the same found set from one form to another? For instance, I currently have a set of three records in FormA. FormB (same table) has a method that does exactly what I need to do right now in FormA. I can easily call that method from within the current method, come back and carry on.
forms.<otherformname>.loadRecords(foundset)
this will pass the foundset of current form to other form
Morley:
I’m discovering the Found Set currently attached to FormB may not necessarily be the same three records. Just calling the FormB method I’m interested in may process the wrong records. Am I correct in this apprehension?
If not based on same table or when loaded records into a form with loadRecords function, this is correct
Thanks Jan, this helps enormously. This concept that individual forms retain their found set just didn’t penetrate until yesterday. So completely foreign to the world of FMP. A critically important concept. Thanks again.
Looking at the 2.0 docs (latest available) for “loadRecords(foundset)”
Note: When this function is called, the form will no longer share the foundset with forms of the same table.
Sorry, don’t understand. What are the implications? What’s this business of sharing foundsets all about? Sharing of foundsets is a concept I’ve not heard before.
If I invoke loadRecords(foundset) from FormA to FormB, I’m assuming the current three records in FormA will be the current foundset for FormB. Is the above warning trying to say that the foundset for FormA is now lost? Unclear.
I’ve got a process running in a method in FormA. In the midst of this I run a method in FormB, after which the method in FormA continues with further steps. I want the current record to still be current both before and after the call to FormB and that the foundset be identical both before and after the “foreign” method call.
if you have 2 forms A and B on the same table A, then normally the use the same shared foundset (so if you search on form A and go to form B you will see the same result)
If then you have a form C from a table C that shows related data table A. And you set that related data foundset on Form A. Then form B will still use that shared global table foundset. But for A will have that related foundset. To convert back to use the shared foundset you have to call loadAllRecords()
Morley:
In FMP scripts (methods) are attached to files (tables), so it’s irrelevant what layout (form) you’re currently on when running a script.
FWIW, it’s very relevant in FM 7.
FOR SURE! Also in FM 7 - is also relevant to what WINDOW is the front-most as well. In Servoy, you can only have a single dialog showing on top so it’s easier to know what “context” you’re in (IMHO).