A5_SAVE_SETTINGS Function
Syntax
Arguments
- setting_name
The name of the setting that you wish to create.
- dot_variable
A dot variable containing values to be saved.
- dictionary
Optional. Default = dictionary (.ALB file) for current database. Path and filename of any Alpha Anywhere library file (i.e. a .ALB, .DDD or .SET file), or a text file.
Description
Saves the contents of 'dot_variable' to a record in the dictionary. Record name is 'setting_name' and type is 'SAVU'.
Discussion
The A5_SAVE_SETTINGS() function replaces the SAVE_SETTINGS() method and saves the values in Dot_Variable to a data dictionary.
Example
The following script defines a dot variable called family then saves the variable using a parent key name of MyFamily.
dim family as P
dim family.kids as P
family.mom = "Irene"
family.dad = "David"
family.kids.first = "Sam"
family.kids.second = "Pam"
a5_save_settings("MyFamily",family, "c:\A5\settings1.txt")The resulting data looks like this:
> >
It is easier to understand the structure of the resulting data, if you imagine it formatted as an outline. For example:
> >
If you want to save settings to a text file, this is how to do it.
dim family as P
dim family.kids as P
family.mom = "Irene"
family.dad = "David"
family.kids.first = "Sam"
family.kids.second = "Pam"
'convert the dot variable to a string
txt = property_to_string(family)
'save the string to a text file
save_to_file(txt,"c:\settings.txt")
delete family
dim family as P
'read the settings from the text file into a variable
txt = get_from_file("c:\settings.txt")
family.mom = ""
property_from_string(family,txt)
? family.mom
= "Irene"See Also