13 Replies Latest reply on Aug 10, 2012 1:42 PM by RonJennings

    Odd FMP5-->FMP11 conversion problem



      Odd FMP5-->FMP11 conversion problem


      First, my apologies for being a FMP scripting noob. Smile

      I coverted a customer's relational FMP5 database(s) to FMP11 and have some odd post conversion problems that seems like it would be related to refreshing a window but inserting the Refresh Window command doesn't resolve it.  I will attempt to describe & welcome all suggestions for resolving

      Database A has a button that calls to Script 1.  Script 1 first confirms they want to perform the script which creates a new record in  Database B and populates that info in to the record being viewed in Database A. Once they confirm, Script 1 in Database A kicks off Script 2 in Database B.  Then the fun starts 

      Script 1 in Database A calls to Script 2 in Database B

      Script 2 executes New Record/Request 

      Script 2 then causes several other scripts in other databases to get kicked off that appear to be working fine then things return to Script 2 in Database B.  

      Script 2 in Database B autopopulates some information from the existing record in Database B into the new record also in Database B  then it calls to another database to get a sequential unique identifier for the new record. it then selects the window for Database B and performs Go To Field for a drop-down selector field so they can proceed with adding the necessary info for the new record.

      Problems/differences from FMP5 to FMP11:

      1) When the last step is processed (going to the drop-down field in the new record) in FMP5, the dropdown actually appears, in FMP11 it doesn't.

      2) There is a clickable link in Database B that should appear and essentailly allow Script 2 to be stopped and prevent the record that is linked to the record from Database A from being altered.  If you change the View in Database B to Layout, the link is there.  However, in version 11, the link won't appear unless you click on the background area of Database A.  Inserting the Refresh Window command into the script doesn't change this behavior

      Any ideas that is causing these behaviors?



        • 1. Re: Odd FMP5-->FMP11 conversion problem

          1) is the drop down field formatted with the arrow option? If so, remove the arrow option and the drop down should deploy when the cursor is put into the field.

          2) Please describe that "clickable link" in more detail. Is it a field? In what layout part is it located? If a field, what storage options are specified for it?

          From what you describe data in File A may need to be committed before it appears on the layout for File B.

          Note: I am using "File" in place of "database" as a "database" in FileMaker can consist of just one file or many files.

          • 2. Re: Odd FMP5-->FMP11 conversion problem

            Sounds like the entire idea is a mess and could stand a rewrite. Probably simpler than trying to fix it...  :)

            Filemaker 11 and 12 have abilities not found in 5 and so it is easier to work with. Mainly the ability to store all of the files as tables in one file. Anyway, rewrite it...

            • 3. Re: Odd FMP5-->FMP11 conversion problem

              1) Nope. No formatting for the dropdown.

              2) Let me put in some non-generic terms to hopefully help with things....

              There are 21 databases total with one of them serving as the "portal" into 6 other primary "interfaceing/data-entry" databases.  All the other databases get populated with information entereed into the 6 primary databases.

              Database A is Stations (as in radio stations).  Database B is Contacts some of which are tied to Stations but not all of them.  The function of the button that kicks everything off is to allow for both changing the contact of a given station w/out having to re-enter all the information that wouldn't change like address, company, or call letters and to create a new, serialized entry in the Contacts database for the new person.  

              The clickable link in Contacts (that isn't appearing unless you first click back to the background of Stations) is the field from Stations that contains the station call letters.  When clicked, it performs a script that does a comparison between any information that may have been entered in the new record for the station contact and the existing record for the station contact before switching back to the Stations window.  In FMP5, this link shows up immediately when the the script started by the button takes you to the Contacts database.


              That help any?

              • 4. Re: Odd FMP5-->FMP11 conversion problem

                @Jack Rodgers:

                Long term: Maybe.

                Short term: Not practical given the schedule and my current FMP programming knowledge.

                • 5. Re: Odd FMP5-->FMP11 conversion problem

                  1) then go to field should deploy the value list. What happens if you just go to this layout and click/tab on/into the field.

                  2) sorry, but that makes 27 different FILES. "Database" is a dangerous term to use in this forum as it's definition changes with the context and the person using it.

                  The clickable link in Contacts (that isn't appearing unless you first click back to the background of Stations) is the field from Stations that contains the station call letters.

                  That's pretty much what I thought here. When you click a layout background any pending edits are committed and this can affect what you see in another window that refers to the same data. I suggest adding a commit records step to the script just before performing the script that brings up the window with the hyperlink.


                  I can't say I disagree with you in any major way here, but keep in mind that this is a working database already in use in it's pior format. Often, we have to convert the dang thing, use some bandaids and chewing gum to complete the conversion and get it working in the newer format, THEN take a crack at rewriting it to take advantage of all the nice new features you now have at your disposal.

                  And sometimes that's a throw out everything but the data and start over proposition and sometimes you can merge files and redesign layouts and scripts in a gradual stepwise process...

                  • 6. Re: Odd FMP5-->FMP11 conversion problem
                     @Phil 1) I'll check that when I get to the office Tuesday. 2) There are 21 files: 1 "database" serves as a "console".  From that console, you access one of 6 databases.  Different data from each of those 6 databases is written to 14 other databases.  I guess you could argue that the structure is 1 primary console, 6 sub consoles (some that also store data) where the actual operational interactions take place, and 14 files that contain data that is shared among the 6 sub consoles but doesn't need direct interaction. The button that starts the scripting fiasco is in Stations.  When you click it and assent to the dialog box question, it starts the script that sends you in to Contacts for entering the data for the new contact.  To my thinking, there isn't any data to be committed prior to the script that sends you into Contacts (but as I said, I'm a noob on this).   Not sure if that makes any difference to your suggestion.  I can post the code segments in question Tuesday if it helps. Thanks Ron
                    • 7. Re: Odd FMP5-->FMP11 conversion problem

                      It's a simple thing to test. Add a commit record step where I recommended and see if it makes any difference.

                      The need to click on a layout suggests that this is needed, but without a more detailed understanding of how everything links together (as in the actual relationships used), I can't really say more than try it and see if it works. Commit records is pretty safe so it's unlikely to have any negative affect--you'll either see that things now work or that you have the same issue as before.

                      • 8. Re: Odd FMP5-->FMP11 conversion problem


                        I don't think I mentioned it before, but the database that isn't deploying the drop-down is the Contacts database (the same one that the button from Stations calls to in the script).  There may be a connection between the problems...

                        When I access Contacts directly (it's one of the 6 I mentioned before), a New Record immediately deploys the drop-down in question.  When I page through the existing records, the dropdown also displays until you click somewhere and cause it to shrink.

                        Could it be that something is causing the script to hang when the field with the dropdown is accessed and that is preventing the layout from loading fully thus causing the hyperlink with the station call letters not to populate?

                        On the items you suggested testing:

                        1) When I access Contacts, I can click the field with the dropdown and it will load.

                        2) I tried inserting a Commit Records in the script just before it calls to Contacts, no change in behavior.

                        • 9. Re: Odd FMP5-->FMP11 conversion problem

                          1) I did a little test to see if I could recreate this issue. What I found was that the drop down would not deploy after Go to Field if the cursor was already in that field. If I modified the script to be:

                          Go to Field []
                          got to field [Table::field]

                          Then the drop down deployed even if the cursor were already in the field.

                          2) I really can't suggest much without knowing a lot more. You might try posting the scripts in question.

                          To post a script to the forum:

                          1. You can upload a screen shot of your script by using the Upload an Image controls located just below Post A Answer.
                          2. You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here.
                          3. If You have FileMaker advanced, you can generate a database design report and copy the script as text from there.
                          4. If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format. (Use the HTML option on the database tab panel and paste the text into the forum's HTML editor.)
                          • 10. Re: Odd FMP5-->FMP11 conversion problem

                            Once again Jack Recomends that Commit Record become a tool that is used. Go To field, if I have the correct data, was used way before Commit Record (Save) was added to Filemaker's tool kit and was one of the few ways to save a record using a script.

                            Testing is always one way of discovering how things work (I just tried opening a file only to discover that away from my Wi-Fi it won't open...) and in the process of opening my current db I reaffirmed that...  :)

                            OK, Filemaker has a bad habit of leaving the cursor in the existing field when you move to the next record. A really bad idea imho.

                            So, you need to commit the record after you move into it to exit the field or do as recommended above.

                            In fact, there is a lot of stuff you should do such as

                            Freeze Window
                            Enter Browse Mode
                            Commit record
                            Set view to Form, etc.
                            Scroll Window Home
                            Set User Abort ON/OFF
                            Set Error Capture On/Off 
                            Hide Toolbar
                            Hide Ruler
                            Adust Window Size To Fit

                            I use a script to set all of that so I don't have to repeat myself:

                            Go to next record/previous
                            Perform script Set Window To Defaults
                            Go To Field XXXX 

                            The use of this script would eliminate such problems as are mentioned here and eliminate the discover of many others.


                            • 11. Re: Odd FMP5-->FMP11 conversion problem

                              I haven't had a chance to test the most recent suggestions (busy week) but here are the

                              In Stations is the script New_Contact:


                              Set Field [Stations::g_Station_ID; Stations::Station_ID]

                              Perform Script ["New_Contact_Radio" from file: "Contacts"]

                              Select Window [Name: "Contacts"]


                              Inserting the Commit Records/Request just ahead of the Perform Script didn't change anything.


                              I believe the problem is in the later part of the New_Contact_Radio script that is in Contacts:


                              New Record/Request

                              Perform Script ["Create_RadioPosition"]

                              Set Field [Contacts::Station_ID; Stations_SRF::g_Station_ID]

                              Set Field [Contacts::Adr_Street; Stations_Station_ID::Adr_Street]

                              Set Field [Contacts::Adr_Street2; Stations_Station_ID::Adr_Street2]

                              Set Field [Contacts::Adr_City; Stations_Station_ID::Adr_City]

                              Set Field [Contacts::Adr_State; Stations_Station_ID::Adr_State]

                              Set Field [Contacts::Adr_Zip; Stations_Station_ID::Adr_Zip]

                              Set Field [Contacts::Cnt_Email; Stations_Station_ID::Cnt_Email]

                              Set Field [Contacts::Nm_Organization; Stations_Station_ID::Nm_Organization]

                              Set Field [Contacts::g_ContactID; Stations_Station_ID::Contact_ID]

                              Perform Script ["Set_New_ContactID" from file "Stations"]

                              Select Window [Current Window]

                              Go to Field [Select/perform; Contacts::Nm_Prefix]


                              All the auto-population stuff happens and the new contact ID does get generated.  What doesn't happen is complete loading of the layout in Contacts (IE the missing hyperlink) nor the Go to Field. So it seems to me the issue has to be in the last 2 lines of New_Contact_Radio.



                              • 12. Re: Odd FMP5-->FMP11 conversion problem

                                There's a lot that I don't see here, but what I can see may be just enough to get this to work for you.

                                You appear to have two relationships between stations and contacts



                                Just guessing that you have:

                                Contacts::OneField = Stations_SRF::OneField  (where the "onefields" store a 1 or other common value in both cases to get a "match to all records" relationship)

                                Contacts::Station_ID = Stations_Station_ID::Station_ID

                                If that's the case, then so far so good. The newer FileMaker files provide other options, but those will still work and this is supported by the fact that the values are sucessfully copied. (These aren't "auto-entered" by the way, that could have been done with looked up value settings for these contacts fields and would have simplified your script to just the first Set field step, but it's not what you have here. )

                                I think your select window may indeed be the culprit. It'd be easy to tell if I were sitting in front of your computer, but since I am not, I must ask a few more questions to clarify:

                                At this point we have two windows open, one for stations and one for contacts due to the "one table to a file" design used here that was necessary for FMP 6 and older.  In which file and window is this hyperlink field? contacts or Station? From which file/table does it get the info shown in it?

                                best guess at this point is that you need to add a commit records step after the last set field step. This will probably fix both issues as Jack has already pointed out that commit records will take the focus out of the drop down field if that's why it isn't dropping down here.

                                On a separate note, do you really need to copy all this contact information? this denormalizes the data. Any changes to this info In Stations will require doing an update on the data in contacts to keep them in synch. Seems like this info should be entered into contacts in the first place and the station ID link can then make it possible to display these contacts fields on any layout in stations where you need to see this data. This is a design change that may make life simpler for you once you get the files and scripts working correctly.

                                • 13. Re: Odd FMP5-->FMP11 conversion problem

                                  Sorry for the delay getting back on this.  Good news to report though!

                                  As Jack Rodgers suspected, the source of the problem was a lack of the Commit Record command at various places in the databases.  I guess version 5 did some of that automagicly where the command has to be explictly entered for some things to work properly in the migrated version?

                                  Thanks to everyone for their help, especially JR.  I was able to scratch a long-lingering project/problem off at work.  Which if course means they gave me 3 others to work on.  Posts on that coming in a new thread.