I built a simple CRM system, having some basic settings as global variables, how can I save these data in my file? Should I have to create another database for saving these settings?
The data can be hard coded into scripts. If the data changes then yes you would have to store the data in a table. I usually create a system table to house this type data. I also use global fields (logos - containers) , then in a startup script I will copy the data from a regular field to a global field.
Globals are a special beast.
- unique to the current user
- lose their current value when database is closed
- on startup they return to the value they eventually had when you shared the database for the first time
Back to your problem,
you should have a settings table with 1 record per user, maybe identified by get(PersistentID), where you store the value of globals in real fields and retrieve their values on startup.
on startup, SetVariable $$ID to ExecuteSQL("SELECT pid from Settings WHERE pid = ? ";"";""; Get(PersistentID)).
If IsEmpty($$ID), create new record, if not, put $$ID into a global and GTRR to fetch the global values from static fields.
Retrieving data ...