Reading Settings
You can read individual settings values for database objects corresponding to the fields shown in the Settings window in the Model Manager workspace. You can also retrieve all settings values via an optimized get method on a database object — thereby reducing network latency overhead when, for example, reading settings values from a Model Manager server database.
Examples
Get settings values for the model version currently opened in the COMSOL Desktop and write them to the Debug Log window.
String tag = model.tag();
ModelItemVersion version = api.modelVersionByModelTag(tag);
 
debugLog(version.title());
debugLog(version.filename());
debugLog(version.description());
debugLog(formattedDateTime(version.saved()));
debugLog(version.savedBy());
debugLog(version.savedIn());
debugLog(version.owner());
 
// The settings values can also be retrieved collectively from
// the database via the optimized get method.
GetModelItemVersionResult result = version.get();
 
debugLog(result.title());
debugLog(result.filename());
// ...
The formattedDateTime method from the Method Editor’s built-in method library converts the UNIX epoch milliseconds returned by saved to a read-friendly date and time string.
Get settings values for a file version referenced as an output file by a table feature in the model object.
ExportFeature f = model.result().export("table1");
String fileLocationUri = f.getString("filename");
 
FileItemVersion version = api
  .fileVersionByLocationUri(fileLocationUri);
 
debugLog(version.title());
debugLog(version.description());
debugLog(formattedDateTime(version.saved()));
debugLog(version.savedBy());
debugLog(version.savedIn());
debugLog(version.owner());
 
FileResourceResult fileResource = version
  .firstFileResourceOrNull();
 
debugLog(fileResource.path().filename());
debugLog(fileResource.size());
debugLog(fileResource.lastModified());
The previous code snippet assumed that the file version had a single file resource, that is, it is not a fileset.