You refer to a global field from a database that is hosted from FileMaker Server. Is this the field that does not retain a value when you close the file?
This is expected behavior for global fields in a hosted database.
PS. I can't tell from your post what roles variables play in your issue here, but no variable, whether $$Global or $Script will retain a value when the file is closed.
Yes, both fields are global and when I restart the data disappears
In the local database not on server fields are same but do not disappear.
As you can see in my script, I am trying to put a protection in line . If you have a better idea, I would appreciate your thoughts.
There's some confusion with $DateOK, and $$DateOK (which I don't see at all in the script). $$DateOk would have to be initialized when the user starts a session.
Also in your script, you set the $DateOK variable, but you don't follow up with Set Field
I do not have $$DateOK in my script, I just thought that might be my problem.
I just looked at the script from the database that this works in and it does not have a setfield after that first Set Variable.
Is there any way I can make this better? Or work.
You'll need to explain exactly what this script is supposed to do, What layout is current when this script runs (on what table is it based?) and how your data is set up in tables/relationships.
I don't see any fields in your script that should be defined as global fields.
EXACTLY what fields appear as blank when you re-open the file?
This might simply be a case that your found set is not retained when you close/re-open and thus the current record on your screen is not the same record that you had when you closed it.
That last part is correct, when I close the database it is on the last record I was on, when I open database, it is on the first one.
This is typical of a hosted database. The simplest solution is to set up a script performed by the OnFirstWindowOpen script to select both the correct layout and the correct record before it does anything else.
Show All Records
Go To Record/Request/Page [Last]
What I am trying to do is put a script together that has a date is the future that if someone with full access can keep changing but if they let everyone go with full access that the database would close once that date was reached. The developer that assisted before had the date field and the expire field set as global, do they not need to be global?
I put a closing script in with
Show all records
Go to Layout Equipment
Go to Record/Request/Page [First}
Show all Records
Go to Layout Equipment
Go to Record/Request/Page [First]
I changed from global to not global on both fields
Still clears fields
I know very little about your database and what you are trying to do.
All I can see is that you have a script that checks the value of a field from the context of a single record--probably from a layout based on a table occurrence named "Equipment" but I can't be sure of that from what I see here. You've indicated that you have multiple records in this table and that you want the above script to run from the context of the last record in this table.
Thus, I have suggested a way to make sure that the above script runs from a context of the last record in the table.
Beyond that, you'll need to keep in mind how little I know about your database and what you are trying to do.
What you describe does not sound like a date to store in a table named equipment. Instead, this sounds like a value that should be stored in a separate table with just one record. Your start up script can either just go to a layout based on that table to check the expiration date or it can copy the value to a global field or variable to make it accessible from all layouts, scripts in your file.
But I must also observe that if the people with full access are not the owners of this intellectual property, this set up could be seen from a legal stand point as "employee sabotage" much like an employee setting up the only full access password on the file and then not communicating this password to management when they exit the company for any reason.