February 24, 201312 yr I have this script sequence:   It uses this layout : _global   Here is the structure:   For some reason (therein lies the problem) accessing this layout and issuing the 'delete' command does not delete the Lodge Name, address, address2, phone and a few other fields. But, it does delete 95% of the fields. (The Phone has auto enter calculation. But the addresses are regular global fields). I think FM does not import calculated fields but does an autoenter calculation qualify for that exclusion? Also, why don't the address fields get deleted? I am perplexed.  What am I missing? I can't see it.  Update: I just stepped through script and every other _layout worked perfectly. The code to delete all records in each layout is the same. So, somehow it is the layout?  Thanks  Ron
February 24, 201312 yr Your script is deleting the records, but it cannot remove the content from global fields. Global fields will persist even when there are no records in the file - that is one of their key features. Re-examine why you created the address fields as globals.
February 25, 201312 yr Author "... can not delete the content from global fields". hmmmmm.... I read something similar in Feiler's "FM In Depth". I wonder if I can use a Replace to effectively remove the content of the global fields? (Surely there is some kind of workaround for deleting global field contents?)
February 25, 201312 yr Solution It isn't clear what you're doing or why; but you misunderstand the nature of global fields. There is only one instance of a global field and that instance exists whether you have any records in the table or not. You only need to use set field. Your script needs to do this for each field you wish to clear. Set field [ gDate; ""] Set field [ gSomethingElse; ""]
February 25, 201312 yr Although you might clear the data as BruceR shows, also be aware that the data is only cleared from the context of the user who cleared it. In a multiuser setup each user has their own instance of the global fields and their values. This behaviour is the different with conventional fields where each user will see the changes made by any other users immediately. (Surely there is some kind of workaround for deleting global field contents? Not as far is I know - but I wouldn't use global fields in this way, and wouldn't need a 'workaround'.
March 30, 201312 yr Author March 29 Continuing.....I just reread what was previously submitted... And, it makes a lot of sense. Thanks  But, the current problem is this: I have version 21 of my program. Version 21 has sample data. When a prior user gets v21 they need to erase all the 'sample' data and import their 'real' data from version 20.  I have written the script to delete the tables and then 'add' the target tables and it works great.... Except for my global table. When I import and ADD, I ultimately end up with literally thousands of records.   Question: "What is the best way to import the global records from v 20 into v 21???  Thanks for your ideas...  Ron
Create an account or sign in to comment